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

Last change on this file since 7851 was 7851, checked in by Nicklas Nordborg, 2 years ago

References #2222: Add support for manually adding any-to-any link column in table lists

Added a simple dialog for adding any-to-any columns. It is enabled on all lists by default and should be disabled in places were it is not supported (such as lists that mix different kinds of items).

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