source: trunk/www/common/context/saveas.jsp @ 5812

Last change on this file since 5812 was 5812, checked in by Nicklas Nordborg, 11 years ago

Fixes #1629: Use <label> instead of javascript for text associated with radio buttons

Radio buttons and checkboxes should now be fixed. The exception is checkboxes/radiobuttons in list pages. The reason is that the action depends on the list mode. In most cases the action is to open the view- or edit- page, not to check the radio button or checkbox.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.9 KB
Line 
1<%-- $Id: saveas.jsp 5812 2011-10-17 14:19:38Z 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<%
36final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
37final String ID = sc.getId();
38final Item itemType = Item.valueOf(request.getParameter("item_type"));
39final String subContext = request.getParameter("subcontext");
40final ItemContext current = sc.getCurrentContext(itemType, subContext);
41final 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  <p>
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  <h3 class="docked">Save preset as... <base:help helpid="contexts.saveas" /></h3>
86  <div class="boxed" align="center">
87    <br>
88    <table class="form" cellspacing=0>
89    <tr>
90      <td class="prompt">For item</td>
91      <td><%=itemType%><%="".equals(subContext) ? "" : " ("+subContext+")"%></td>
92    </tr>
93    <tr>
94      <td class="prompt">Name</td>
95      <td><input class="text required" type="text" name="name" value="<%=HTML.encodeTags(name)%>" size="40" maxlength="40"></td>
96    </tr>
97    <tr>
98      <td class="prompt"><label for="overwrite">Overwrite existing</label></td>
99      <td><input type="checkbox" name="overwrite" id="overwrite" value="1" <%=name == null ? "" : "checked"%>></td>
100    </tr>
101    <%
102    if (sc.hasSystemPermission(Permission.SHARE_TO_EVERYONE))
103    {
104      %>
105      <tr>
106        <td class="prompt"><label for="public">Public</label></td>
107        <td><input type="checkbox" name="public" id="public" value="1"></td>
108      </tr>
109      <%
110    }
111    %>
112    <tr>
113      <td colspan="2">
114      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
115      </td>
116    </tr>
117    </table>
118    <p>
119  </div>
120  </form>
121
122  <table align="center">
123  <tr>
124    <td width="50%"><base:button onclick="savePreset();" title="Ok" /></td>
125    <td width="50%"><base:button onclick="window.close();" title="Cancel" /></td>
126  </tr>
127  </table>
128
129</base:body>
130</base:page>
Note: See TracBrowser for help on using the repository browser.