source: branches/3.18-stable/www/common/columns/configure.jsp @ 7957

Last change on this file since 7957 was 7957, checked in by Nicklas Nordborg, 22 months ago

References #2253: Configure sticky column

It should now be possible to select a sticky column in the "Configure columns" dialog. The setting is stored in the current ItemContext under the key columns.sticky.

So far, only the raw bioassays list page has been update to use the new setting.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.0 KB
Line 
1<%-- $Id: configure.jsp 7957 2021-06-03 07:39:33Z 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 boolean enableRelatedItemColumns = Values.getBoolean(request.getParameter("enableRelatedItemColumns"));
57final boolean enableLinkedItemColumns = Values.getBoolean(request.getParameter("enableLinkedItemColumns"));
58final boolean enableStickyColumn = Values.getBoolean(request.getParameter("enableStickyColumn"));
59final ItemContext cc = sc.getCurrentContext(itemType, subContext);
60
61final String defaultColumns = cc.getObject("defaultColumns");
62final String defaultSticky = cc.getObject("defaultColumns.sticky");
63final String settingName = Values.getString(request.getParameter("settingName"), "columns");
64%>
65  <base:page type="popup" title="Set column order and visibility">
66  <base:head scripts="~configure.js" styles="toolbar.css" />
67  <base:body>
68    <h1>Set column order and visiblity <base:help helpid="columns.configure" /></h1>
69   
70    <div id="page-data" class="datacontainer"
71      data-table-id="<%=tableId%>"
72      data-default-columns="<%=HTML.encodeTags(defaultColumns) %>"
73      data-default-sticky="<%=HTML.encodeTags(defaultSticky) %>"
74      data-item-type="<%=itemType.name() %>"
75      data-subcontext="<%=subContext %>"
76      data-setting-name="<%=settingName %>"
77      ></div>
78   
79    <form name="columns">
80    <div class="content bg-filled-50 bottomborder">
81    <table style="width: 100%; height: 100%;">
82    <%
83    if (enableInheritedAnnotations || enableRelatedItemColumns || enableLinkedItemColumns)
84    {
85      %>
86      <tr>
87        <td colspan="4" style="vertical-align: top;">
88        <tbl:toolbar subclass="bottomborder">
89          <tbl:button 
90            id="selectAnnotationTypes" 
91            image="add.png"
92            title="Add inherited annotations&hellip;" 
93            tooltip="Add columns for inherited annotations" 
94            visible="<%=enableInheritedAnnotations %>"
95           />
96          <tbl:button 
97            id="selectRelatedItemColumn" 
98            image="add.png"
99            title="Add parent or child item columns&hellip;" 
100            tooltip="Add columns from parent or child items" 
101            visible="<%=enableRelatedItemColumns %>"
102           />
103          <tbl:button 
104            id="selectLinkedItemColumn" 
105            image="add.png"
106            title="Add linked columns&hellip;" 
107            tooltip="Add columns from linked items" 
108            visible="<%=enableLinkedItemColumns %>"
109           />
110        </tbl:toolbar>
111        </td>
112      </tr>
113      <%
114    }
115    %>
116    <tr>
117      <td style="padding: 5px;">
118        <base:buttongroup vertical="true">
119          <base:button
120            id="moveUp"
121            image="move_up.png" 
122            tooltip="Move up" 
123            subclass="square"
124            data-down="0"
125          />
126          <base:button 
127            id="moveDown"
128            image="move_down.png" 
129            tooltip="Move down" 
130            subclass="square"
131            data-down="1"
132          />
133        </base:buttongroup>
134      </td>
135 
136      <td style="width: 45%;">
137        <b>Visible columns</b><br>
138        <select name="visible" id="visible" multiple size="16" style="width: calc(100% - 10px);">
139        </select>
140      </td>
141      <td style="padding: 5px;">
142        <base:buttongroup vertical="true">
143          <base:button
144            id="moveLeft"
145            image="move_left.png" 
146            tooltip="Make the selected hidden column(s) visible" 
147            subclass="square"
148          />
149          <base:button 
150            id="moveRight"
151            image="move_right.png" 
152            tooltip="Make the selected visible column(s) hidden" 
153            subclass="square"
154          />
155        </base:buttongroup>
156      </td>
157 
158      <td style="width: 45%; padding-right: 5px;">
159        <b>Hidden columns</b><br>
160        <select name="hidden" id="hidden" multiple size="16" style="width: calc(100% - 10px);">
161        </select>
162      </td>
163    </tr>
164    <tr>
165      <td></td>
166      <%
167      // The layout will be different depending on if the "Sticky column" option
168      // is available or not
169      if (enableStickyColumn)
170      {
171        // We display the "Sticky column" and "Presets" side-by-side
172        %>
173        <td>
174        <b>Sticky column</b><br>
175        <select name="sticky" id="sticky" style="width: calc(100% - 10px);"></select>
176        </td>
177        <td></td>
178        <td>
179        <b>Presets</b><br>
180        <table style="width: 100%;">
181        <tr>
182        <td>
183        <%
184      }
185      else
186      {
187        // We display the "Presets" centered
188        %>
189        <td colspan="3">
190        <table style="margin-left: auto; margin-right: auto;">
191        <tr>
192        <td style="padding-right: 0.5em;"><b>Presets</b></td>
193        <td>
194        <%
195      }
196      %>
197      <select name="presets" id="presets" style="width: calc(100% - 10px);">
198        <option value="">-- predefined --
199        <option value="all">All
200        <option value="_minimal_">Required
201        <option value="_current_">Current
202        <%
203        if (defaultColumns != null)
204        {
205          %>
206          <option value="_default_">Default
207          <%
208        }
209        %>
210        <option value="">-- user defined --
211        <%
212        Enumeration<Integer, String> contexts = sc.getContextNames(itemType, subContext);
213        for (int i = 0; i < contexts.size(); ++i)
214        {
215          ItemContext context = sc.getContext(contexts.getKey(i));
216          if (context != null && !ItemContext.DEFAULT_NAME.equals(context.getName()))
217          {
218            String columns = context.getSetting(settingName);
219            String stickyColumn = context.getSetting(settingName+".sticky");
220            if (columns != null)
221            {
222              %>
223              <option value="<%=columns%>" 
224              <%if (stickyColumn != null){%>
225              data-sticky-column="<%=stickyColumn%>"
226              <%}%>
227              ><%=HTML.encodeTags(context.getName())%>
228              <%
229            }
230          }
231        }
232        %>
233      </select>
234      </td>
235      <%
236      if (request.getParameter("nosavedelete") == null)
237      {
238        %>
239        <td><base:button id="btnSavePreset" title="Save as&hellip;" /></td>
240        <%
241      }
242      %>
243      </tr>
244      </table>
245      </td>
246    </tr>
247    <tr>
248    <td colspan="4" >
249      <div class="padded" style="text-align: right;">
250        <b>×</b> = This column cannot be hidden
251      </div>
252    </td>
253    </tr>
254    </table>
255    </div>
256    </form>
257    <base:buttongroup subclass="dialogbuttons">
258      <base:button id="btnSave" title="Ok" />
259      <base:button id="close" title="Cancel" />
260    </base:buttongroup>
261  </base:body>
262  </base:page>
Note: See TracBrowser for help on using the repository browser.