source: branches/2.8-stable/www/common/context/saveas.jsp @ 4506

Last change on this file since 4506 was 4506, checked in by Nicklas Nordborg, 14 years ago

References #118: Change problematic forms to use POST instead of GET

I have changed most of the forms I could find to use POST instead of GET. Many of them are probably not problematic, but I found some:

  • Form for JEP extra value calculator plug-in
  • Form for JEP intensity transformer plug-in
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.9 KB
Line 
1<%-- $Id: saveas.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  @author Nicklas
26  @version 2.0
27--%>
28<%@ page session="false"
29  import="net.sf.basedb.core.SessionControl"
30  import="net.sf.basedb.core.Item"
31  import="net.sf.basedb.core.Permission"
32  import="net.sf.basedb.core.ItemContext"
33  import="net.sf.basedb.clients.web.Base"
34  import="net.sf.basedb.clients.web.util.HTML"
35%>
36<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
37<%
38final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
39final String ID = sc.getId();
40final Item itemType = Item.valueOf(request.getParameter("item_type"));
41final String subContext = request.getParameter("subcontext");
42final ItemContext current = sc.getCurrentContext(itemType, subContext);
43final String name = ItemContext.DEFAULT_NAME.equals(current.getName()) ? null : current.getName();
44%>
45<base:page type="popup" title="Save preset as...">
46<base:head>
47  <script language="JavaScript">
48  // Initialise - set focus to name field
49  function init()
50  {
51    var frm = document.forms["preset"];
52    frm.name.focus();
53  }
54
55  // Validate the form
56  function validateForm()
57  {
58    var frm = document.forms["preset"];
59    if (Main.trimString(frm.name.value) == '')
60    {
61      frm.name.focus();
62      alert("Please enter a name");
63      return false;
64    }
65    return true;
66  }
67
68  // Submit the form
69  function savePreset()
70  {
71    var frm = document.forms["preset"];
72    if (validateForm())
73    {
74      frm.submit();
75    }
76  }
77  </script>
78</base:head>
79<base:body onload="init()">
80  <p>
81  <form name="preset" action="index.jsp" method="post" onsubmit="return validateForm();">
82  <input type=hidden name="ID" value="<%=ID%>">
83  <input type=hidden name="cmd" value="SaveCurrentContext">
84  <input type=hidden name="item_type" value="<%=itemType.name()%>">
85  <input type=hidden name="subcontext" value="<%=subContext%>">
86
87  <h3 class="docked">Save preset as... <base:help helpid="contexts.saveas" /></h3>
88  <div class="boxed" align="center">
89    <br>
90    <table class="form" cellspacing=0>
91    <tr>
92      <td class="prompt">For item</td>
93      <td><%=itemType%><%="".equals(subContext) ? "" : " ("+subContext+")"%></td>
94    </tr>
95    <tr>
96      <td class="prompt">Name</td>
97      <td><input class="text required" type="text" name="name" value="<%=HTML.encodeTags(name)%>" size="40" maxlength="40"></td>
98    </tr>
99    <tr>
100      <td class="prompt">Overwrite existing</td>
101      <td><input type="checkbox" name="overwrite" value="1" <%=name == null ? "" : "checked"%>></td>
102    </tr>
103    <%
104    if (sc.hasSystemPermission(Permission.SHARE_TO_EVERYONE))
105    {
106      %>
107      <tr>
108        <td class="prompt">Public</td>
109        <td><input type="checkbox" name="public" value="1"></td>
110      </tr>
111      <%
112    }
113    %>
114    <tr>
115      <td colspan="2">
116      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
117      </td>
118    </tr>
119    </table>
120    <p>
121  </div>
122  </form>
123
124  <table align="center">
125  <tr>
126    <td width="50%"><base:button onclick="savePreset();" title="Ok" /></td>
127    <td width="50%"><base:button onclick="window.close();" title="Cancel" /></td>
128  </tr>
129  </table>
130
131</base:body>
132</base:page>
Note: See TracBrowser for help on using the repository browser.