source: branches/2.8-stable/www/views/experiments/overview/save_preset.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.4 KB
Line 
1<%-- $Id: save_preset.jsp 4506 2008-09-11 09:29:40Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2007 Nicklas Nordborg
4
5  This file is part of BASE - BioArray Software Environment.
6  Available at http://base.thep.lu.se/
7
8  BASE is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License
10  as published by the Free Software Foundation; either version 3
11  of the License, or (at your option) any later version.
12
13  BASE is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA  02111-1307, USA.
22  ------------------------------------------------------------------
23
24  Ask for confirmation to delete a preset.
25
26
27  @author Nicklas
28  @version 2.0
29--%>
30<%@ page session="false"
31  import="net.sf.basedb.core.SessionControl"
32  import="net.sf.basedb.core.Item"
33  import="net.sf.basedb.clients.web.Base"
34  import="net.sf.basedb.clients.web.util.HTML"
35  import="net.sf.basedb.util.Values"
36%>
37<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
38<%
39final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
40final String ID = sc.getId();
41%>
42<base:page type="popup" title="Save preset">
43<base:head>
44  <script language="JavaScript">
45  // Initialise - set focus to name field
46  function init()
47  {
48    var frm = document.forms["preset"];
49    var presets = window.opener.document.forms['options'].presets;
50    frm.name.value = presets[presets.selectedIndex].value;
51    frm.name.focus();
52  }
53
54  // Validate the form
55  function validateForm()
56  {
57    var frm = document.forms["preset"];
58    if (Main.trimString(frm.name.value) == '')
59    {
60      frm.name.focus();
61      alert("Please enter a name");
62      return false;
63    }
64    var presets = window.opener.document.forms['options'].presets;
65    for (var i = 0; i < presets.length; i++) // >
66    {
67      if (presets[i].text == frm.name.value)
68      {
69        return confirm('Another preset with the same name already exists. Do want to replace it?');
70      }
71    }
72    return true;
73  }
74
75  // Submit the form
76  function savePreset()
77  {
78    var frm = document.forms["preset"];
79    if (validateForm())
80    {
81      window.opener.saveAsPreset(frm.name.value);
82      window.close();
83    }
84  }
85  </script>
86</base:head>
87<base:body onload="init()">
88  <p>
89  <form name="preset" action="index.jsp" method="post" onsubmit="return validateForm();">
90  <input type="hidden" name="ID" value="<%=ID%>">
91  <input type="hidden" name="cmd" value="Save">
92 
93
94  <h3 class="docked">Save preset <base:help helpid="experiment.overview.validationoptions.savepreset" /></h3>
95  <div class="boxed" align="center">
96    <br>
97    <table class="form" cellspacing=0>
98    <tr>
99      <td class="prompt">Name</td>
100      <td><input class="text required" type="text" name="name" value="" size="40" maxlength="40"></td>
101    </tr>
102    <tr>
103      <td colspan="2">
104      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
105      </td>
106    </tr>
107    </table>
108    <p>
109  </div>
110  </form>
111
112  <table align="center">
113  <tr>
114    <td width="50%"><base:button onclick="savePreset();" title="Ok" /></td>
115    <td width="50%"><base:button onclick="window.close();" title="Cancel" /></td>
116  </tr>
117  </table>
118
119</base:body>
120</base:page>
Note: See TracBrowser for help on using the repository browser.