source: trunk/www/common/columns/submit_preset.jsp @ 6192

Last change on this file since 6192 was 6192, checked in by Nicklas Nordborg, 10 years ago

References #1729 and #1730.

Refactored the code for displaying a popup message when loading a page. The message should now be stored as a session setting instead: sc.setSessionSetting("alert-message", message). The added benefit is that the message is only displayed once and is not re-displayed if the page is reloaded.

Removed onunload, onkeypress and attributes from the <base:body> tag. Added support for dynamic attributes instead.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.9 KB
Line 
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<%
48final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
49final String ID = sc.getId();
50final Item itemType = Item.valueOf(request.getParameter("item_type"));
51final String subContext = Values.getString(request.getParameter("subcontext"), "");
52final String cmd = request.getParameter("cmd");
53final String root = request.getContextPath()+"/";
54final String name = request.getParameter("name");
55final String settingName = Values.getString(request.getParameter("settingName"), "columns");
56final ItemContext cc = sc.getCurrentContext(itemType, subContext);
57String forward = null;
58String message = null;
59
60if ("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
67if (forward != null)
68{
69  sc.setSessionSetting("alert-message", message);
70  pageContext.forward(forward);
71}
72else if (message == null)
73{
74  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=0&wait=0");
75}
76else
77{
78  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=0&message="+HTML.urlEncode(message));
79}
80%>
Note: See TracBrowser for help on using the repository browser.