1 | <%-- $Id: save_preset.jsp 4506 2008-09-11 09:29:40Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2005 Nicklas Nordborg |
---|
4 | Copyright (C) 2006 Jari Hakkinen, Nicklas Nordborg, Martin Svensson |
---|
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 this program; if not, write to the Free Software |
---|
21 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
22 | Boston, MA 02111-1307, USA. |
---|
23 | ------------------------------------------------------------------ |
---|
24 | |
---|
25 | Ask for confirmation to delete a preset. |
---|
26 | |
---|
27 | |
---|
28 | @author Nicklas |
---|
29 | @version 2.0 |
---|
30 | --%> |
---|
31 | <%@ page session="false" |
---|
32 | import="net.sf.basedb.core.SessionControl" |
---|
33 | import="net.sf.basedb.core.Item" |
---|
34 | import="net.sf.basedb.clients.web.Base" |
---|
35 | import="net.sf.basedb.clients.web.util.HTML" |
---|
36 | import="net.sf.basedb.util.Values" |
---|
37 | %> |
---|
38 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
39 | <% |
---|
40 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
41 | final String ID = sc.getId(); |
---|
42 | final Item itemType = Item.valueOf(request.getParameter("item_type")); |
---|
43 | final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
---|
44 | final String columns = request.getParameter("columns"); |
---|
45 | %> |
---|
46 | <base:page type="popup" title="Save preset"> |
---|
47 | <base:head> |
---|
48 | <script language="JavaScript"> |
---|
49 | // Initialise - set focus to name field |
---|
50 | function init() |
---|
51 | { |
---|
52 | var frm = document.forms["preset"]; |
---|
53 | frm.name.focus(); |
---|
54 | } |
---|
55 | |
---|
56 | // Validate the form |
---|
57 | function validateForm() |
---|
58 | { |
---|
59 | var frm = document.forms["preset"]; |
---|
60 | if (Main.trimString(frm.name.value) == '') |
---|
61 | { |
---|
62 | frm.name.focus(); |
---|
63 | alert("Please enter a name"); |
---|
64 | return false; |
---|
65 | } |
---|
66 | var presets = window.opener.document.forms['columns'].presets; |
---|
67 | for (var i = 0; i < presets.length; i++) // > |
---|
68 | { |
---|
69 | if (presets[i].text == frm.name.value) |
---|
70 | { |
---|
71 | return confirm('Another preset with the same name already exists. Do want to replace it?'); |
---|
72 | } |
---|
73 | } |
---|
74 | return true; |
---|
75 | } |
---|
76 | |
---|
77 | // Submit the form |
---|
78 | function savePreset() |
---|
79 | { |
---|
80 | var frm = document.forms["preset"]; |
---|
81 | if (validateForm()) |
---|
82 | { |
---|
83 | frm.submit(); |
---|
84 | } |
---|
85 | } |
---|
86 | </script> |
---|
87 | </base:head> |
---|
88 | <base:body onload="init()"> |
---|
89 | <p> |
---|
90 | <form name="preset" action="submit_preset.jsp" method="post" onsubmit="return validateForm();"> |
---|
91 | <input type="hidden" name="ID" value="<%=ID%>"> |
---|
92 | <input type="hidden" name="cmd" value="Save"> |
---|
93 | <input type="hidden" name="columns" value="<%=HTML.encodeTags(columns)%>"> |
---|
94 | <input type="hidden" name="item_type" value="<%=itemType.name()%>"> |
---|
95 | <input type="hidden" name="subcontext" value="<%=subContext%>"> |
---|
96 | |
---|
97 | |
---|
98 | <h3 class="docked">Save preset <base:help helpid="columns.configure.saveas" /></h3> |
---|
99 | <div class="boxed" align="center"> |
---|
100 | <br> |
---|
101 | <table class="form" cellspacing=0> |
---|
102 | <tr> |
---|
103 | <td class="prompt">Name</td> |
---|
104 | <td><input class="text required" type="text" name="name" value="" size="40" maxlength="40"></td> |
---|
105 | </tr> |
---|
106 | <tr> |
---|
107 | <td colspan="2"> |
---|
108 | <div align=right> <i><base:icon image="required.gif" /> = required information</i></div> |
---|
109 | </td> |
---|
110 | </tr> |
---|
111 | </table> |
---|
112 | <p> |
---|
113 | </div> |
---|
114 | </form> |
---|
115 | |
---|
116 | <table align="center"> |
---|
117 | <tr> |
---|
118 | <td width="50%"><base:button onclick="savePreset();" title="Ok" /></td> |
---|
119 | <td width="50%"><base:button onclick="window.close();" title="Cancel" /></td> |
---|
120 | </tr> |
---|
121 | </table> |
---|
122 | |
---|
123 | </base:body> |
---|
124 | </base:page> |
---|