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