1 | <%-- $Id: configure.jsp 6608 2014-11-20 07:58:36Z 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 | |
---|
49 | <% |
---|
50 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
51 | final String ID = sc.getId(); |
---|
52 | final Item itemType = Item.valueOf(request.getParameter("item_type")); |
---|
53 | final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
---|
54 | final String tableId = request.getParameter("table_id"); |
---|
55 | final ItemContext cc = sc.getCurrentContext(itemType, subContext); |
---|
56 | |
---|
57 | final String defaultColumns = (String)cc.getObject("defaultColumns"); |
---|
58 | final String settingName = Values.getString(request.getParameter("settingName"), "columns"); |
---|
59 | %> |
---|
60 | <base:page type="popup" title="Set column order and visibility"> |
---|
61 | <base:head scripts="~configure.js" /> |
---|
62 | <base:body> |
---|
63 | <h1>Set column order and visiblity <base:help helpid="columns.configure" /></h1> |
---|
64 | |
---|
65 | <div id="page-data" class="datacontainer" |
---|
66 | data-table-id="<%=tableId%>" |
---|
67 | data-default-columns="<%=HTML.encodeTags(defaultColumns) %>" |
---|
68 | data-item-type="<%=itemType.name() %>" |
---|
69 | data-subcontext="<%=subContext %>" |
---|
70 | data-setting-name="<%=settingName %>" |
---|
71 | ></div> |
---|
72 | |
---|
73 | <form name="columns"> |
---|
74 | <div class="content bg-filled-50 bottomborder"> |
---|
75 | <table style="width: 100%; height: 100%;"> |
---|
76 | <tr> |
---|
77 | <td style="padding: 5px;"> |
---|
78 | <base:buttongroup vertical="true"> |
---|
79 | <base:button |
---|
80 | id="moveUp" |
---|
81 | image="move_up.png" |
---|
82 | tooltip="Move up" |
---|
83 | subclass="square" |
---|
84 | data-down="0" |
---|
85 | /> |
---|
86 | <base:button |
---|
87 | id="moveDown" |
---|
88 | image="move_down.png" |
---|
89 | tooltip="Move down" |
---|
90 | subclass="square" |
---|
91 | data-down="1" |
---|
92 | /> |
---|
93 | </base:buttongroup> |
---|
94 | </td> |
---|
95 | |
---|
96 | <td style="width: 45%;"> |
---|
97 | <b>Visible columns</b><br> |
---|
98 | <select name="visible" id="visible" multiple size="16" style="width: calc(100% - 10px);"> |
---|
99 | </select> |
---|
100 | </td> |
---|
101 | <td style="padding: 5px;"> |
---|
102 | <base:buttongroup vertical="true"> |
---|
103 | <base:button |
---|
104 | id="moveLeft" |
---|
105 | image="move_left.png" |
---|
106 | tooltip="Make the selected hidden column(s) visible" |
---|
107 | subclass="square" |
---|
108 | /> |
---|
109 | <base:button |
---|
110 | id="moveRight" |
---|
111 | image="move_right.png" |
---|
112 | tooltip="Make the selected visible column(s) hidden" |
---|
113 | subclass="square" |
---|
114 | /> |
---|
115 | </base:buttongroup> |
---|
116 | </td> |
---|
117 | |
---|
118 | <td style="width: 45%; padding-right: 5px;"> |
---|
119 | <b>Hidden columns</b><br> |
---|
120 | <select name="hidden" id="hidden" multiple size="16" style="width: calc(100% - 10px);"> |
---|
121 | </select> |
---|
122 | </td> |
---|
123 | </tr> |
---|
124 | <tr> |
---|
125 | <td colspan="4" > |
---|
126 | <table style="margin-left: auto; margin-right: auto;"> |
---|
127 | <tr> |
---|
128 | <td> |
---|
129 | <b>Presets</b> |
---|
130 | <select name="presets" id="presets"> |
---|
131 | <option value="">-- predefined -- |
---|
132 | <option value="all">All |
---|
133 | <option value="_minimal_">Required |
---|
134 | <option value="_current_">Current |
---|
135 | <% |
---|
136 | if (defaultColumns != null) |
---|
137 | { |
---|
138 | %> |
---|
139 | <option value="_default_">Default |
---|
140 | <% |
---|
141 | } |
---|
142 | %> |
---|
143 | <option value="">-- user defined -- |
---|
144 | <% |
---|
145 | Enumeration<Integer, String> contexts = sc.getContextNames(itemType, subContext); |
---|
146 | for (int i = 0; i < contexts.size(); ++i) |
---|
147 | { |
---|
148 | ItemContext context = sc.getContext(contexts.getKey(i)); |
---|
149 | if (context != null && !ItemContext.DEFAULT_NAME.equals(context.getName())) |
---|
150 | { |
---|
151 | String columns = context.getSetting(settingName); |
---|
152 | if (columns != null) |
---|
153 | { |
---|
154 | %> |
---|
155 | <option value="<%=columns%>"><%=HTML.encodeTags(context.getName())%> |
---|
156 | <% |
---|
157 | } |
---|
158 | } |
---|
159 | } |
---|
160 | %> |
---|
161 | </select> |
---|
162 | </td> |
---|
163 | <% |
---|
164 | if (request.getParameter("nosavedelete") == null) |
---|
165 | { |
---|
166 | %> |
---|
167 | <td><base:button id="btnSavePreset" title="Save as…" /></td> |
---|
168 | <% |
---|
169 | } |
---|
170 | %> |
---|
171 | </tr> |
---|
172 | </table> |
---|
173 | |
---|
174 | <div class="padded" style="text-align: right;"> |
---|
175 | <b>×</b> = This column cannot be hidden |
---|
176 | </div> |
---|
177 | |
---|
178 | </td> |
---|
179 | </tr> |
---|
180 | </table> |
---|
181 | </div> |
---|
182 | </form> |
---|
183 | <base:buttongroup subclass="dialogbuttons"> |
---|
184 | <base:button id="btnSave" title="Ok" /> |
---|
185 | <base:button id="close" title="Cancel" /> |
---|
186 | </base:buttongroup> |
---|
187 | </base:body> |
---|
188 | </base:page> |
---|