1 | <%-- $Id: saveas.jsp 5907 2011-12-13 08:36:28Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2005 Nicklas Nordborg |
---|
4 | Copyright (C) 2006 Jari Häkkinen, 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 BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | ------------------------------------------------------------------ |
---|
22 | |
---|
23 | @author Nicklas |
---|
24 | @version 2.0 |
---|
25 | --%> |
---|
26 | <%@ page pageEncoding="UTF-8" session="false" |
---|
27 | import="net.sf.basedb.core.SessionControl" |
---|
28 | import="net.sf.basedb.core.Item" |
---|
29 | import="net.sf.basedb.core.Permission" |
---|
30 | import="net.sf.basedb.core.ItemContext" |
---|
31 | import="net.sf.basedb.clients.web.Base" |
---|
32 | import="net.sf.basedb.clients.web.util.HTML" |
---|
33 | %> |
---|
34 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
35 | <% |
---|
36 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
37 | final String ID = sc.getId(); |
---|
38 | final Item itemType = Item.valueOf(request.getParameter("item_type")); |
---|
39 | final String subContext = request.getParameter("subcontext"); |
---|
40 | final ItemContext current = sc.getCurrentContext(itemType, subContext); |
---|
41 | final String name = ItemContext.DEFAULT_NAME.equals(current.getName()) ? null : current.getName(); |
---|
42 | %> |
---|
43 | <base:page type="popup" title="Save preset as..."> |
---|
44 | <base:head> |
---|
45 | <script language="JavaScript"> |
---|
46 | // Initialise - set focus to name field |
---|
47 | function init() |
---|
48 | { |
---|
49 | var frm = document.forms["preset"]; |
---|
50 | frm.name.focus(); |
---|
51 | } |
---|
52 | |
---|
53 | // Validate the form |
---|
54 | function validateForm() |
---|
55 | { |
---|
56 | var frm = document.forms["preset"]; |
---|
57 | if (Main.trimString(frm.name.value) == '') |
---|
58 | { |
---|
59 | frm.name.focus(); |
---|
60 | alert("Please enter a name"); |
---|
61 | return false; |
---|
62 | } |
---|
63 | return true; |
---|
64 | } |
---|
65 | |
---|
66 | // Submit the form |
---|
67 | function savePreset() |
---|
68 | { |
---|
69 | var frm = document.forms["preset"]; |
---|
70 | if (validateForm()) |
---|
71 | { |
---|
72 | frm.submit(); |
---|
73 | } |
---|
74 | } |
---|
75 | </script> |
---|
76 | </base:head> |
---|
77 | <base:body onload="init()"> |
---|
78 | <h1>Save preset as... <base:help helpid="contexts.saveas" /></h1> |
---|
79 | <form name="preset" action="index.jsp" method="post" onsubmit="return validateForm();"> |
---|
80 | <input type=hidden name="ID" value="<%=ID%>"> |
---|
81 | <input type=hidden name="cmd" value="SaveCurrentContext"> |
---|
82 | <input type=hidden name="item_type" value="<%=itemType.name()%>"> |
---|
83 | <input type=hidden name="subcontext" value="<%=subContext%>"> |
---|
84 | |
---|
85 | <div class="content bottomborder"> |
---|
86 | <table class="fullform input100 smaller"> |
---|
87 | <tr> |
---|
88 | <th>For item</th> |
---|
89 | <td><%=itemType%><%="".equals(subContext) ? "" : " ("+subContext+")"%></td> |
---|
90 | </tr> |
---|
91 | <tr> |
---|
92 | <th>Name</th> |
---|
93 | <td><input class="text required" type="text" name="name" value="<%=HTML.encodeTags(name)%>" size="40" maxlength="40"></td> |
---|
94 | </tr> |
---|
95 | <tr> |
---|
96 | <th><label for="overwrite">Overwrite existing</label></th> |
---|
97 | <td><input type="checkbox" name="overwrite" id="overwrite" value="1" <%=name == null ? "" : "checked"%>></td> |
---|
98 | </tr> |
---|
99 | <% |
---|
100 | if (sc.hasSystemPermission(Permission.SHARE_TO_EVERYONE)) |
---|
101 | { |
---|
102 | %> |
---|
103 | <tr> |
---|
104 | <th><label for="public">Public</label></th> |
---|
105 | <td><input type="checkbox" name="public" id="public" value="1"></td> |
---|
106 | </tr> |
---|
107 | <% |
---|
108 | } |
---|
109 | %> |
---|
110 | <tr class="dynamic"> |
---|
111 | <th></th> |
---|
112 | <td><div align=right> <i><base:icon image="required.gif" /> = required information</i></div></td> |
---|
113 | </tr> |
---|
114 | </table> |
---|
115 | |
---|
116 | </div> |
---|
117 | </form> |
---|
118 | |
---|
119 | <base:buttongroup subclass="dialogbuttons"> |
---|
120 | <base:button onclick="savePreset();" title="Ok" /> |
---|
121 | <base:button onclick="window.close();" title="Cancel" /> |
---|
122 | </base:buttongroup> |
---|
123 | |
---|
124 | </base:body> |
---|
125 | </base:page> |
---|