source: trunk/www/common/columns/configure.jsp @ 6689

Last change on this file since 6689 was 6689, checked in by Nicklas Nordborg, 8 years ago

References #1906: Display inherited annotations in list views

The "Configure columns" dialog can now be used to add inherited annotation columns. This must be enabled from the list page by setting <tbl:table ... data-inherited-annotations="true"> in the table definition.

First implementation is made in the list raw bioassays table.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.2 KB
Line 
1<%-- $Id: configure.jsp 6689 2015-01-21 10:35:06Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Gregory Vincic
5  Copyright (C) 2007 Nicklas Nordborg
6
7  This file is part of BASE - BioArray Software Environment.
8  Available at http://base.thep.lu.se/
9
10  BASE is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License
12  as published by the Free Software Foundation; either version 3
13  of the License, or (at your option) any later version.
14
15  BASE is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with BASE. If not, see <http://www.gnu.org/licenses/>.
22  ------------------------------------------------------------------
23
24  Configure the order and visibility of columns in a table of items.
25  This page will use the TableColumn.getTableColumns(item) to retreive the
26  list of all available columns for that item type and
27  getSession().getSetting(item+".columns") to retreive a comma-separated
28  list of the current order of visible columns.
29
30  @param item The type of items in the table
31
32  @author Nicklas
33  @version 2.0
34--%>
35<%@ page pageEncoding="UTF-8" session="false"
36  import="net.sf.basedb.core.SessionControl"
37  import="net.sf.basedb.core.Item"
38  import="net.sf.basedb.core.ItemContext"
39  import="net.sf.basedb.util.Enumeration"
40  import="net.sf.basedb.clients.web.util.HTML"
41  import="net.sf.basedb.util.Values"
42  import="net.sf.basedb.clients.web.Base"
43  import="java.util.Set"
44  import="java.util.TreeSet"
45%>
46<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
47<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
48<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
49<%
50final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
51final String ID = sc.getId();
52final Item itemType = Item.valueOf(request.getParameter("item_type"));
53final String subContext = Values.getString(request.getParameter("subcontext"), "");
54final String tableId = request.getParameter("table_id");
55final boolean enableInheritedAnnotations = Values.getBoolean(request.getParameter("enableInheritedAnnotations"));
56final ItemContext cc = sc.getCurrentContext(itemType, subContext);
57
58final String defaultColumns = (String)cc.getObject("defaultColumns");
59final String settingName = Values.getString(request.getParameter("settingName"), "columns");
60%>
61  <base:page type="popup" title="Set column order and visibility">
62  <base:head scripts="~configure.js" styles="toolbar.css" />
63  <base:body>
64    <h1>Set column order and visiblity <base:help helpid="columns.configure" /></h1>
65   
66    <div id="page-data" class="datacontainer"
67      data-table-id="<%=tableId%>"
68      data-default-columns="<%=HTML.encodeTags(defaultColumns) %>"
69      data-item-type="<%=itemType.name() %>"
70      data-subcontext="<%=subContext %>"
71      data-setting-name="<%=settingName %>"
72      ></div>
73   
74    <form name="columns">
75    <div class="content bg-filled-50 bottomborder">
76    <table style="width: 100%; height: 100%;">
77    <%
78    if (enableInheritedAnnotations)
79    {
80      %>
81      <tr>
82        <td colspan="4" style="vertical-align: top;">
83        <tbl:toolbar subclass="bottomborder">
84          <tbl:button 
85            id="selectAnnotationTypes" 
86            image="add.png"
87            title="Add inherited annotations&hellip;" 
88            tooltip="Add columns for inherited annotations" 
89           />
90        </tbl:toolbar>
91        </td>
92      </tr>
93      <%
94    }
95    %>
96    <tr>
97      <td style="padding: 5px;">
98        <base:buttongroup vertical="true">
99          <base:button
100            id="moveUp"
101            image="move_up.png" 
102            tooltip="Move up" 
103            subclass="square"
104            data-down="0"
105          />
106          <base:button 
107            id="moveDown"
108            image="move_down.png" 
109            tooltip="Move down" 
110            subclass="square"
111            data-down="1"
112          />
113        </base:buttongroup>
114      </td>
115 
116      <td style="width: 45%;">
117        <b>Visible columns</b><br>
118        <select name="visible" id="visible" multiple size="16" style="width: calc(100% - 10px);">
119        </select>
120      </td>
121      <td style="padding: 5px;">
122        <base:buttongroup vertical="true">
123          <base:button
124            id="moveLeft"
125            image="move_left.png" 
126            tooltip="Make the selected hidden column(s) visible" 
127            subclass="square"
128          />
129          <base:button 
130            id="moveRight"
131            image="move_right.png" 
132            tooltip="Make the selected visible column(s) hidden" 
133            subclass="square"
134          />
135        </base:buttongroup>
136      </td>
137 
138      <td style="width: 45%; padding-right: 5px;">
139        <b>Hidden columns</b><br>
140        <select name="hidden" id="hidden" multiple size="16" style="width: calc(100% - 10px);">
141        </select>
142      </td>
143    </tr>
144    <tr>
145      <td colspan="4" >
146        <table style="margin-left: auto; margin-right: auto;">
147        <tr>
148        <td>
149          <b>Presets</b>
150          <select name="presets" id="presets">
151            <option value="">-- predefined --
152            <option value="all">All
153            <option value="_minimal_">Required
154            <option value="_current_">Current
155            <%
156            if (defaultColumns != null)
157            {
158              %>
159              <option value="_default_">Default
160              <%
161            }
162            %>
163            <option value="">-- user defined --
164            <%
165            Enumeration<Integer, String> contexts = sc.getContextNames(itemType, subContext);
166            for (int i = 0; i < contexts.size(); ++i)
167            {
168              ItemContext context = sc.getContext(contexts.getKey(i));
169              if (context != null && !ItemContext.DEFAULT_NAME.equals(context.getName()))
170              {
171                String columns = context.getSetting(settingName);
172                if (columns != null)
173                {
174                  %>
175                  <option value="<%=columns%>"><%=HTML.encodeTags(context.getName())%>
176                  <%
177                }
178              }
179            }
180            %>
181          </select>
182          </td>
183          <%
184          if (request.getParameter("nosavedelete") == null)
185          {
186            %>
187            <td><base:button id="btnSavePreset" title="Save as&hellip;" /></td>
188            <%
189          }
190          %>
191        </tr>
192        </table>
193
194        <div class="padded" style="text-align: right;">
195          <b>×</b> = This column cannot be hidden
196        </div>
197
198      </td>
199    </tr>
200    </table>
201    </div>
202    </form>
203    <base:buttongroup subclass="dialogbuttons">
204      <base:button id="btnSave" title="Ok" />
205      <base:button id="close" title="Cancel" />
206    </base:buttongroup>
207  </base:body>
208  </base:page>
Note: See TracBrowser for help on using the repository browser.