381 |
08 Apr 05 |
nicklas |
1 |
<%-- $Id$ |
381 |
08 Apr 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
4889 |
06 Apr 09 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Gregory Vincic |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg |
381 |
08 Apr 05 |
nicklas |
6 |
|
2304 |
22 May 06 |
jari |
7 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
8 |
Available at http://base.thep.lu.se/ |
381 |
08 Apr 05 |
nicklas |
9 |
|
381 |
08 Apr 05 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
381 |
08 Apr 05 |
nicklas |
11 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
12 |
as published by the Free Software Foundation; either version 3 |
381 |
08 Apr 05 |
nicklas |
13 |
of the License, or (at your option) any later version. |
381 |
08 Apr 05 |
nicklas |
14 |
|
381 |
08 Apr 05 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
381 |
08 Apr 05 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
381 |
08 Apr 05 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
381 |
08 Apr 05 |
nicklas |
18 |
GNU General Public License for more details. |
381 |
08 Apr 05 |
nicklas |
19 |
|
381 |
08 Apr 05 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
381 |
08 Apr 05 |
nicklas |
22 |
------------------------------------------------------------------ |
381 |
08 Apr 05 |
nicklas |
23 |
|
381 |
08 Apr 05 |
nicklas |
24 |
Configure the order and visibility of columns in a table of items. |
381 |
08 Apr 05 |
nicklas |
25 |
This page will use the TableColumn.getTableColumns(item) to retreive the |
381 |
08 Apr 05 |
nicklas |
26 |
list of all available columns for that item type and |
381 |
08 Apr 05 |
nicklas |
27 |
getSession().getSetting(item+".columns") to retreive a comma-separated |
381 |
08 Apr 05 |
nicklas |
28 |
list of the current order of visible columns. |
381 |
08 Apr 05 |
nicklas |
29 |
|
381 |
08 Apr 05 |
nicklas |
30 |
@param item The type of items in the table |
381 |
08 Apr 05 |
nicklas |
31 |
|
424 |
20 Apr 05 |
nicklas |
32 |
@author Nicklas |
381 |
08 Apr 05 |
nicklas |
33 |
@version 2.0 |
381 |
08 Apr 05 |
nicklas |
34 |
--%> |
5426 |
24 Sep 10 |
nicklas |
35 |
<%@ page pageEncoding="UTF-8" session="false" |
390 |
12 Apr 05 |
nicklas |
36 |
import="net.sf.basedb.core.SessionControl" |
395 |
14 Apr 05 |
nicklas |
37 |
import="net.sf.basedb.core.Item" |
2017 |
17 Feb 06 |
nicklas |
38 |
import="net.sf.basedb.core.ItemContext" |
2017 |
17 Feb 06 |
nicklas |
39 |
import="net.sf.basedb.util.Enumeration" |
390 |
12 Apr 05 |
nicklas |
40 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
41 |
import="net.sf.basedb.util.Values" |
381 |
08 Apr 05 |
nicklas |
42 |
import="net.sf.basedb.clients.web.Base" |
390 |
12 Apr 05 |
nicklas |
43 |
import="java.util.Set" |
390 |
12 Apr 05 |
nicklas |
44 |
import="java.util.TreeSet" |
381 |
08 Apr 05 |
nicklas |
45 |
%> |
381 |
08 Apr 05 |
nicklas |
46 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
381 |
08 Apr 05 |
nicklas |
47 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6689 |
21 Jan 15 |
nicklas |
48 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
381 |
08 Apr 05 |
nicklas |
49 |
<% |
501 |
02 May 05 |
nicklas |
50 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
501 |
02 May 05 |
nicklas |
51 |
final String ID = sc.getId(); |
501 |
02 May 05 |
nicklas |
52 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
2017 |
17 Feb 06 |
nicklas |
53 |
final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
501 |
02 May 05 |
nicklas |
54 |
final String tableId = request.getParameter("table_id"); |
6689 |
21 Jan 15 |
nicklas |
55 |
final boolean enableInheritedAnnotations = Values.getBoolean(request.getParameter("enableInheritedAnnotations")); |
7842 |
01 Sep 20 |
nicklas |
56 |
final boolean enableRelatedItemColumns = Values.getBoolean(request.getParameter("enableRelatedItemColumns")); |
7851 |
14 Oct 20 |
nicklas |
57 |
final boolean enableLinkedItemColumns = Values.getBoolean(request.getParameter("enableLinkedItemColumns")); |
7982 |
14 Jun 21 |
nicklas |
58 |
final boolean enableStickyColumn = Values.getBoolean(request.getParameter("enableStickyColumn")); |
6182 |
23 Oct 12 |
nicklas |
59 |
final ItemContext cc = sc.getCurrentContext(itemType, subContext); |
6182 |
23 Oct 12 |
nicklas |
60 |
|
7605 |
26 Feb 19 |
nicklas |
61 |
final String defaultColumns = cc.getObject("defaultColumns"); |
7982 |
14 Jun 21 |
nicklas |
62 |
final String defaultSticky = cc.getObject("defaultColumns.sticky"); |
5111 |
30 Sep 09 |
nicklas |
63 |
final String settingName = Values.getString(request.getParameter("settingName"), "columns"); |
381 |
08 Apr 05 |
nicklas |
64 |
%> |
415 |
18 Apr 05 |
nicklas |
65 |
<base:page type="popup" title="Set column order and visibility"> |
6689 |
21 Jan 15 |
nicklas |
66 |
<base:head scripts="~configure.js" styles="toolbar.css" /> |
6186 |
29 Oct 12 |
nicklas |
67 |
<base:body> |
6186 |
29 Oct 12 |
nicklas |
68 |
<h1>Set column order and visiblity <base:help helpid="columns.configure" /></h1> |
2027 |
20 Feb 06 |
gregory |
69 |
|
6186 |
29 Oct 12 |
nicklas |
70 |
<div id="page-data" class="datacontainer" |
6186 |
29 Oct 12 |
nicklas |
71 |
data-table-id="<%=tableId%>" |
6186 |
29 Oct 12 |
nicklas |
72 |
data-default-columns="<%=HTML.encodeTags(defaultColumns) %>" |
7982 |
14 Jun 21 |
nicklas |
73 |
data-default-sticky="<%=HTML.encodeTags(defaultSticky) %>" |
6186 |
29 Oct 12 |
nicklas |
74 |
data-item-type="<%=itemType.name() %>" |
6186 |
29 Oct 12 |
nicklas |
75 |
data-subcontext="<%=subContext %>" |
6186 |
29 Oct 12 |
nicklas |
76 |
data-setting-name="<%=settingName %>" |
6186 |
29 Oct 12 |
nicklas |
77 |
></div> |
415 |
18 Apr 05 |
nicklas |
78 |
|
6162 |
10 Oct 12 |
nicklas |
79 |
<form name="columns"> |
6607 |
19 Nov 14 |
nicklas |
80 |
<div class="content bg-filled-50 bottomborder"> |
5907 |
13 Dec 11 |
nicklas |
81 |
<table style="width: 100%; height: 100%;"> |
6689 |
21 Jan 15 |
nicklas |
82 |
<% |
7851 |
14 Oct 20 |
nicklas |
83 |
if (enableInheritedAnnotations || enableRelatedItemColumns || enableLinkedItemColumns) |
6689 |
21 Jan 15 |
nicklas |
84 |
{ |
6689 |
21 Jan 15 |
nicklas |
85 |
%> |
6689 |
21 Jan 15 |
nicklas |
86 |
<tr> |
6689 |
21 Jan 15 |
nicklas |
87 |
<td colspan="4" style="vertical-align: top;"> |
6689 |
21 Jan 15 |
nicklas |
88 |
<tbl:toolbar subclass="bottomborder"> |
6689 |
21 Jan 15 |
nicklas |
89 |
<tbl:button |
6689 |
21 Jan 15 |
nicklas |
90 |
id="selectAnnotationTypes" |
6689 |
21 Jan 15 |
nicklas |
91 |
image="add.png" |
6689 |
21 Jan 15 |
nicklas |
92 |
title="Add inherited annotations…" |
6689 |
21 Jan 15 |
nicklas |
93 |
tooltip="Add columns for inherited annotations" |
7773 |
17 Feb 20 |
nicklas |
94 |
visible="<%=enableInheritedAnnotations %>" |
6689 |
21 Jan 15 |
nicklas |
95 |
/> |
7773 |
17 Feb 20 |
nicklas |
96 |
<tbl:button |
7842 |
01 Sep 20 |
nicklas |
97 |
id="selectRelatedItemColumn" |
7773 |
17 Feb 20 |
nicklas |
98 |
image="add.png" |
7842 |
01 Sep 20 |
nicklas |
99 |
title="Add parent or child item columns…" |
7842 |
01 Sep 20 |
nicklas |
100 |
tooltip="Add columns from parent or child items" |
7842 |
01 Sep 20 |
nicklas |
101 |
visible="<%=enableRelatedItemColumns %>" |
7773 |
17 Feb 20 |
nicklas |
102 |
/> |
7851 |
14 Oct 20 |
nicklas |
103 |
<tbl:button |
7851 |
14 Oct 20 |
nicklas |
104 |
id="selectLinkedItemColumn" |
7851 |
14 Oct 20 |
nicklas |
105 |
image="add.png" |
7851 |
14 Oct 20 |
nicklas |
106 |
title="Add linked columns…" |
7851 |
14 Oct 20 |
nicklas |
107 |
tooltip="Add columns from linked items" |
7851 |
14 Oct 20 |
nicklas |
108 |
visible="<%=enableLinkedItemColumns %>" |
7851 |
14 Oct 20 |
nicklas |
109 |
/> |
6689 |
21 Jan 15 |
nicklas |
110 |
</tbl:toolbar> |
6689 |
21 Jan 15 |
nicklas |
111 |
</td> |
6689 |
21 Jan 15 |
nicklas |
112 |
</tr> |
6689 |
21 Jan 15 |
nicklas |
113 |
<% |
6689 |
21 Jan 15 |
nicklas |
114 |
} |
6689 |
21 Jan 15 |
nicklas |
115 |
%> |
415 |
18 Apr 05 |
nicklas |
116 |
<tr> |
5907 |
13 Dec 11 |
nicklas |
117 |
<td style="padding: 5px;"> |
5907 |
13 Dec 11 |
nicklas |
118 |
<base:buttongroup vertical="true"> |
5907 |
13 Dec 11 |
nicklas |
119 |
<base:button |
6186 |
29 Oct 12 |
nicklas |
120 |
id="moveUp" |
5907 |
13 Dec 11 |
nicklas |
121 |
image="move_up.png" |
5907 |
13 Dec 11 |
nicklas |
122 |
tooltip="Move up" |
5907 |
13 Dec 11 |
nicklas |
123 |
subclass="square" |
6186 |
29 Oct 12 |
nicklas |
124 |
data-down="0" |
5907 |
13 Dec 11 |
nicklas |
125 |
/> |
5907 |
13 Dec 11 |
nicklas |
126 |
<base:button |
6186 |
29 Oct 12 |
nicklas |
127 |
id="moveDown" |
5907 |
13 Dec 11 |
nicklas |
128 |
image="move_down.png" |
5907 |
13 Dec 11 |
nicklas |
129 |
tooltip="Move down" |
5907 |
13 Dec 11 |
nicklas |
130 |
subclass="square" |
6186 |
29 Oct 12 |
nicklas |
131 |
data-down="1" |
5907 |
13 Dec 11 |
nicklas |
132 |
/> |
5907 |
13 Dec 11 |
nicklas |
133 |
</base:buttongroup> |
415 |
18 Apr 05 |
nicklas |
134 |
</td> |
415 |
18 Apr 05 |
nicklas |
135 |
|
5907 |
13 Dec 11 |
nicklas |
136 |
<td style="width: 45%;"> |
415 |
18 Apr 05 |
nicklas |
137 |
<b>Visible columns</b><br> |
6608 |
20 Nov 14 |
nicklas |
138 |
<select name="visible" id="visible" multiple size="16" style="width: calc(100% - 10px);"> |
415 |
18 Apr 05 |
nicklas |
139 |
</select> |
415 |
18 Apr 05 |
nicklas |
140 |
</td> |
5907 |
13 Dec 11 |
nicklas |
141 |
<td style="padding: 5px;"> |
5907 |
13 Dec 11 |
nicklas |
142 |
<base:buttongroup vertical="true"> |
5907 |
13 Dec 11 |
nicklas |
143 |
<base:button |
6186 |
29 Oct 12 |
nicklas |
144 |
id="moveLeft" |
5907 |
13 Dec 11 |
nicklas |
145 |
image="move_left.png" |
5907 |
13 Dec 11 |
nicklas |
146 |
tooltip="Make the selected hidden column(s) visible" |
5907 |
13 Dec 11 |
nicklas |
147 |
subclass="square" |
5907 |
13 Dec 11 |
nicklas |
148 |
/> |
5907 |
13 Dec 11 |
nicklas |
149 |
<base:button |
6186 |
29 Oct 12 |
nicklas |
150 |
id="moveRight" |
5907 |
13 Dec 11 |
nicklas |
151 |
image="move_right.png" |
5907 |
13 Dec 11 |
nicklas |
152 |
tooltip="Make the selected visible column(s) hidden" |
5907 |
13 Dec 11 |
nicklas |
153 |
subclass="square" |
5907 |
13 Dec 11 |
nicklas |
154 |
/> |
5907 |
13 Dec 11 |
nicklas |
155 |
</base:buttongroup> |
415 |
18 Apr 05 |
nicklas |
156 |
</td> |
415 |
18 Apr 05 |
nicklas |
157 |
|
5907 |
13 Dec 11 |
nicklas |
158 |
<td style="width: 45%; padding-right: 5px;"> |
415 |
18 Apr 05 |
nicklas |
159 |
<b>Hidden columns</b><br> |
6608 |
20 Nov 14 |
nicklas |
160 |
<select name="hidden" id="hidden" multiple size="16" style="width: calc(100% - 10px);"> |
415 |
18 Apr 05 |
nicklas |
161 |
</select> |
415 |
18 Apr 05 |
nicklas |
162 |
</td> |
6689 |
21 Jan 15 |
nicklas |
163 |
</tr> |
415 |
18 Apr 05 |
nicklas |
164 |
<tr> |
7982 |
14 Jun 21 |
nicklas |
165 |
<td></td> |
7982 |
14 Jun 21 |
nicklas |
166 |
<% |
7982 |
14 Jun 21 |
nicklas |
167 |
// The layout will be different depending on if the "Sticky column" option |
7982 |
14 Jun 21 |
nicklas |
168 |
// is available or not |
7982 |
14 Jun 21 |
nicklas |
169 |
if (enableStickyColumn) |
7982 |
14 Jun 21 |
nicklas |
170 |
{ |
7982 |
14 Jun 21 |
nicklas |
171 |
// We display the "Sticky column" and "Presets" side-by-side |
7982 |
14 Jun 21 |
nicklas |
172 |
%> |
7982 |
14 Jun 21 |
nicklas |
173 |
<td> |
7982 |
14 Jun 21 |
nicklas |
174 |
<b>Sticky column</b><br> |
7982 |
14 Jun 21 |
nicklas |
175 |
<select name="sticky" id="sticky" style="width: calc(100% - 10px);"></select> |
7982 |
14 Jun 21 |
nicklas |
176 |
</td> |
7982 |
14 Jun 21 |
nicklas |
177 |
<td></td> |
7982 |
14 Jun 21 |
nicklas |
178 |
<td> |
7982 |
14 Jun 21 |
nicklas |
179 |
<b>Presets</b><br> |
7982 |
14 Jun 21 |
nicklas |
180 |
<table style="width: 100%;"> |
7982 |
14 Jun 21 |
nicklas |
181 |
<tr> |
7982 |
14 Jun 21 |
nicklas |
182 |
<td> |
7982 |
14 Jun 21 |
nicklas |
183 |
<% |
7982 |
14 Jun 21 |
nicklas |
184 |
} |
7982 |
14 Jun 21 |
nicklas |
185 |
else |
7982 |
14 Jun 21 |
nicklas |
186 |
{ |
7982 |
14 Jun 21 |
nicklas |
187 |
// We display the "Presets" centered |
7982 |
14 Jun 21 |
nicklas |
188 |
%> |
7982 |
14 Jun 21 |
nicklas |
189 |
<td colspan="3"> |
5907 |
13 Dec 11 |
nicklas |
190 |
<table style="margin-left: auto; margin-right: auto;"> |
1786 |
18 Jan 06 |
nicklas |
191 |
<tr> |
7982 |
14 Jun 21 |
nicklas |
192 |
<td style="padding-right: 0.5em;"><b>Presets</b></td> |
522 |
04 May 05 |
nicklas |
193 |
<td> |
7982 |
14 Jun 21 |
nicklas |
194 |
<% |
7982 |
14 Jun 21 |
nicklas |
195 |
} |
7982 |
14 Jun 21 |
nicklas |
196 |
%> |
7982 |
14 Jun 21 |
nicklas |
197 |
<select name="presets" id="presets" style="width: calc(100% - 10px);"> |
7982 |
14 Jun 21 |
nicklas |
198 |
<option value="">-- predefined -- |
7982 |
14 Jun 21 |
nicklas |
199 |
<option value="all">All |
7982 |
14 Jun 21 |
nicklas |
200 |
<option value="_minimal_">Required |
7982 |
14 Jun 21 |
nicklas |
201 |
<option value="_current_">Current |
7982 |
14 Jun 21 |
nicklas |
202 |
<% |
7982 |
14 Jun 21 |
nicklas |
203 |
if (defaultColumns != null) |
7982 |
14 Jun 21 |
nicklas |
204 |
{ |
7982 |
14 Jun 21 |
nicklas |
205 |
%> |
7982 |
14 Jun 21 |
nicklas |
206 |
<option value="_default_">Default |
7982 |
14 Jun 21 |
nicklas |
207 |
<% |
7982 |
14 Jun 21 |
nicklas |
208 |
} |
7982 |
14 Jun 21 |
nicklas |
209 |
%> |
7982 |
14 Jun 21 |
nicklas |
210 |
<option value="">-- user defined -- |
7982 |
14 Jun 21 |
nicklas |
211 |
<% |
7982 |
14 Jun 21 |
nicklas |
212 |
Enumeration<Integer, String> contexts = sc.getContextNames(itemType, subContext); |
7982 |
14 Jun 21 |
nicklas |
213 |
for (int i = 0; i < contexts.size(); ++i) |
7982 |
14 Jun 21 |
nicklas |
214 |
{ |
7982 |
14 Jun 21 |
nicklas |
215 |
ItemContext context = sc.getContext(contexts.getKey(i)); |
7982 |
14 Jun 21 |
nicklas |
216 |
if (context != null && !ItemContext.DEFAULT_NAME.equals(context.getName())) |
7982 |
14 Jun 21 |
nicklas |
217 |
{ |
7982 |
14 Jun 21 |
nicklas |
218 |
String columns = context.getSetting(settingName); |
7982 |
14 Jun 21 |
nicklas |
219 |
String stickyColumn = context.getSetting(settingName+".sticky"); |
7982 |
14 Jun 21 |
nicklas |
220 |
if (columns != null) |
415 |
18 Apr 05 |
nicklas |
221 |
{ |
415 |
18 Apr 05 |
nicklas |
222 |
%> |
7982 |
14 Jun 21 |
nicklas |
223 |
<option value="<%=columns%>" |
7982 |
14 Jun 21 |
nicklas |
224 |
<%if (stickyColumn != null){%> |
7982 |
14 Jun 21 |
nicklas |
225 |
data-sticky-column="<%=stickyColumn%>" |
7982 |
14 Jun 21 |
nicklas |
226 |
<%}%> |
7982 |
14 Jun 21 |
nicklas |
227 |
><%=HTML.encodeTags(context.getName())%> |
415 |
18 Apr 05 |
nicklas |
228 |
<% |
415 |
18 Apr 05 |
nicklas |
229 |
} |
1714 |
14 Dec 05 |
nicklas |
230 |
} |
7982 |
14 Jun 21 |
nicklas |
231 |
} |
7982 |
14 Jun 21 |
nicklas |
232 |
%> |
7982 |
14 Jun 21 |
nicklas |
233 |
</select> |
415 |
18 Apr 05 |
nicklas |
234 |
</td> |
7982 |
14 Jun 21 |
nicklas |
235 |
<% |
7982 |
14 Jun 21 |
nicklas |
236 |
if (request.getParameter("nosavedelete") == null) |
7982 |
14 Jun 21 |
nicklas |
237 |
{ |
7982 |
14 Jun 21 |
nicklas |
238 |
%> |
7982 |
14 Jun 21 |
nicklas |
239 |
<td><base:button id="btnSavePreset" title="Save as…" /></td> |
7982 |
14 Jun 21 |
nicklas |
240 |
<% |
7982 |
14 Jun 21 |
nicklas |
241 |
} |
7982 |
14 Jun 21 |
nicklas |
242 |
%> |
7982 |
14 Jun 21 |
nicklas |
243 |
</tr> |
7982 |
14 Jun 21 |
nicklas |
244 |
</table> |
7982 |
14 Jun 21 |
nicklas |
245 |
</td> |
415 |
18 Apr 05 |
nicklas |
246 |
</tr> |
7982 |
14 Jun 21 |
nicklas |
247 |
<tr> |
7982 |
14 Jun 21 |
nicklas |
248 |
<td colspan="4" > |
7982 |
14 Jun 21 |
nicklas |
249 |
<div class="padded" style="text-align: right;"> |
7982 |
14 Jun 21 |
nicklas |
250 |
<b>×</b> = This column cannot be hidden |
7982 |
14 Jun 21 |
nicklas |
251 |
</div> |
7982 |
14 Jun 21 |
nicklas |
252 |
</td> |
7982 |
14 Jun 21 |
nicklas |
253 |
</tr> |
415 |
18 Apr 05 |
nicklas |
254 |
</table> |
415 |
18 Apr 05 |
nicklas |
255 |
</div> |
415 |
18 Apr 05 |
nicklas |
256 |
</form> |
5907 |
13 Dec 11 |
nicklas |
257 |
<base:buttongroup subclass="dialogbuttons"> |
6186 |
29 Oct 12 |
nicklas |
258 |
<base:button id="btnSave" title="Ok" /> |
6186 |
29 Oct 12 |
nicklas |
259 |
<base:button id="close" title="Cancel" /> |
5907 |
13 Dec 11 |
nicklas |
260 |
</base:buttongroup> |
415 |
18 Apr 05 |
nicklas |
261 |
</base:body> |
5907 |
13 Dec 11 |
nicklas |
262 |
</base:page> |