390 |
12 Apr 05 |
nicklas |
1 |
<%-- $Id$ |
390 |
12 Apr 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
390 |
12 Apr 05 |
nicklas |
5 |
|
2304 |
22 May 06 |
jari |
6 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
7 |
Available at http://base.thep.lu.se/ |
390 |
12 Apr 05 |
nicklas |
8 |
|
390 |
12 Apr 05 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
390 |
12 Apr 05 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
11 |
as published by the Free Software Foundation; either version 3 |
390 |
12 Apr 05 |
nicklas |
12 |
of the License, or (at your option) any later version. |
390 |
12 Apr 05 |
nicklas |
13 |
|
390 |
12 Apr 05 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
390 |
12 Apr 05 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
390 |
12 Apr 05 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
390 |
12 Apr 05 |
nicklas |
17 |
GNU General Public License for more details. |
390 |
12 Apr 05 |
nicklas |
18 |
|
390 |
12 Apr 05 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
390 |
12 Apr 05 |
nicklas |
21 |
------------------------------------------------------------------ |
390 |
12 Apr 05 |
nicklas |
22 |
|
390 |
12 Apr 05 |
nicklas |
23 |
Configure the order and visibility of columns in a table of items. |
390 |
12 Apr 05 |
nicklas |
24 |
This page will use the TableColumn.getTableColumns(item) to retreive the |
390 |
12 Apr 05 |
nicklas |
25 |
list of all available columns for that item type and |
390 |
12 Apr 05 |
nicklas |
26 |
getSession().getSetting(item+".columns") to retreive a comma-separated |
390 |
12 Apr 05 |
nicklas |
27 |
list of the current order of visible columns. |
390 |
12 Apr 05 |
nicklas |
28 |
|
390 |
12 Apr 05 |
nicklas |
29 |
@param item The type of items in the table |
390 |
12 Apr 05 |
nicklas |
30 |
@param cmd |
390 |
12 Apr 05 |
nicklas |
31 |
- Save: To save the settings |
390 |
12 Apr 05 |
nicklas |
32 |
- otherwise: A configuration dialouge is displayed |
390 |
12 Apr 05 |
nicklas |
33 |
@param columns Only used if cmd=Save. Contains a comma-separated list |
390 |
12 Apr 05 |
nicklas |
34 |
of column ID:s which is saved to a user-client setting. |
390 |
12 Apr 05 |
nicklas |
35 |
|
390 |
12 Apr 05 |
nicklas |
36 |
@author Nicklas |
390 |
12 Apr 05 |
nicklas |
37 |
@version 2.0 |
390 |
12 Apr 05 |
nicklas |
38 |
--%> |
5426 |
24 Sep 10 |
nicklas |
39 |
<%@ page pageEncoding="UTF-8" session="false" |
390 |
12 Apr 05 |
nicklas |
40 |
import="net.sf.basedb.core.SessionControl" |
395 |
14 Apr 05 |
nicklas |
41 |
import="net.sf.basedb.core.Item" |
2017 |
17 Feb 06 |
nicklas |
42 |
import="net.sf.basedb.core.ItemContext" |
390 |
12 Apr 05 |
nicklas |
43 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
44 |
import="net.sf.basedb.util.Values" |
390 |
12 Apr 05 |
nicklas |
45 |
import="net.sf.basedb.clients.web.Base" |
390 |
12 Apr 05 |
nicklas |
46 |
%> |
390 |
12 Apr 05 |
nicklas |
47 |
<% |
522 |
04 May 05 |
nicklas |
48 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
522 |
04 May 05 |
nicklas |
49 |
final String ID = sc.getId(); |
522 |
04 May 05 |
nicklas |
50 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
2017 |
17 Feb 06 |
nicklas |
51 |
final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
522 |
04 May 05 |
nicklas |
52 |
final String cmd = request.getParameter("cmd"); |
6186 |
29 Oct 12 |
nicklas |
53 |
final String root = request.getContextPath()+"/"; |
522 |
04 May 05 |
nicklas |
54 |
final String name = request.getParameter("name"); |
5111 |
30 Sep 09 |
nicklas |
55 |
final String settingName = Values.getString(request.getParameter("settingName"), "columns"); |
7982 |
14 Jun 21 |
nicklas |
56 |
final String stickyColumn = Values.getStringOrNull(request.getParameter("stickyColumn")); |
2017 |
17 Feb 06 |
nicklas |
57 |
final ItemContext cc = sc.getCurrentContext(itemType, subContext); |
6186 |
29 Oct 12 |
nicklas |
58 |
String forward = null; |
6186 |
29 Oct 12 |
nicklas |
59 |
String message = null; |
2017 |
17 Feb 06 |
nicklas |
60 |
|
2017 |
17 Feb 06 |
nicklas |
61 |
if ("Save".equals(cmd)) |
390 |
12 Apr 05 |
nicklas |
62 |
{ |
390 |
12 Apr 05 |
nicklas |
63 |
String columns = request.getParameter("columns"); |
5111 |
30 Sep 09 |
nicklas |
64 |
cc.setSetting(settingName, columns); |
7982 |
14 Jun 21 |
nicklas |
65 |
if (stickyColumn != null) cc.setSetting(settingName+".sticky", stickyColumn); |
2017 |
17 Feb 06 |
nicklas |
66 |
sc.saveCurrentContextAs(itemType, subContext, name, true, false); |
390 |
12 Apr 05 |
nicklas |
67 |
} |
6186 |
29 Oct 12 |
nicklas |
68 |
|
6186 |
29 Oct 12 |
nicklas |
69 |
if (forward != null) |
390 |
12 Apr 05 |
nicklas |
70 |
{ |
6192 |
31 Oct 12 |
nicklas |
71 |
sc.setSessionSetting("alert-message", message); |
6186 |
29 Oct 12 |
nicklas |
72 |
pageContext.forward(forward); |
390 |
12 Apr 05 |
nicklas |
73 |
} |
6186 |
29 Oct 12 |
nicklas |
74 |
else if (message == null) |
6186 |
29 Oct 12 |
nicklas |
75 |
{ |
6186 |
29 Oct 12 |
nicklas |
76 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=0&wait=0"); |
6186 |
29 Oct 12 |
nicklas |
77 |
} |
6186 |
29 Oct 12 |
nicklas |
78 |
else |
6186 |
29 Oct 12 |
nicklas |
79 |
{ |
6186 |
29 Oct 12 |
nicklas |
80 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=0&message="+HTML.urlEncode(message)); |
6186 |
29 Oct 12 |
nicklas |
81 |
} |
6186 |
29 Oct 12 |
nicklas |
82 |
%> |