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

Last change on this file since 7773 was 7773, checked in by Nicklas Nordborg, 3 years ago

References #2202: Include information from parent items in list pages

Implemented a simple dialog for selecting parent item columns. It currently allows selecting to display the name of a parent item or any annotation that is attached to it. It can probably be improved a bit more.

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