source: trunk/www/lims/plates/merge_plates.jsp @ 5426

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

References #1514: Fix character encoding of jsp files

  • Add pageEncoding="UTF-8" to all JSP files.
  • Add @charset="UTF-8"; to all CSS files.
  • Add charset="UTF-8" to all <script> tags

This should at least make Eclipse happy and hopefully allow other editors to automatically select the correct encoding.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 5.6 KB
Line 
1<%-- $Id: merge_plates.jsp 5426 2010-09-24 09:18:50Z 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
24  @author Nicklas
25  @version 2.0
26--%>
27<%@ page pageEncoding="UTF-8" session="false"
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.Item"
31  import="net.sf.basedb.core.ItemContext"
32  import="net.sf.basedb.core.Permission"
33  import="net.sf.basedb.core.Plate"
34  import="net.sf.basedb.core.PlateType"
35  import="net.sf.basedb.core.PlateMapping"
36  import="net.sf.basedb.core.BaseException"
37  import="net.sf.basedb.clients.web.Base"
38  import="net.sf.basedb.clients.web.util.HTML"
39  import="net.sf.basedb.util.Values"
40  import="java.util.List"
41%>
42<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
43<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
44<%
45final Item itemType = Item.PLATE;
46final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.CREATE, itemType);
47final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
48final String ID = sc.getId();
49final float scale = Base.getScale(sc);
50final DbControl dc = sc.newDbControl();
51try
52{
53  String title = "Merge plates -- step 1 of 2 -- Select mapping";
54  final String clazz = "class=\"text\"";
55  final String requiredClazz = "class=\"text required\"";
56 
57  // Load recently used items
58  List<PlateMapping> recentPlateMappings = (List<PlateMapping>)cc.getRecent(dc, Item.PLATEMAPPING);
59  List<PlateType> recentPlateTypes = (List<PlateType>)cc.getRecent(dc, Item.PLATETYPE);
60  %>
61
62  <base:page type="popup" title="<%=title%>">
63  <base:head>
64    <script language="JavaScript">
65    // Validate the entered information
66    function validate()
67    {
68      var frm = document.forms['merge'];
69      if (Main.trimString(frm.name.value) == '')
70      {
71        alert("You must enter a name");
72        frm.name.focus();
73        return false;
74      }
75      if (frm.platemapping_id[frm.platemapping_id.selectedIndex].value == '')
76      {
77        alert("You must select a plate mapping");
78        return false;
79      }
80      if (frm.platetype_id[frm.platetype_id.selectedIndex].value == '')
81      {
82        alert("You must select a plate type");
83        return false;
84      }
85      return true;
86    }
87
88    // Submit the form
89    function nextStep()
90    {
91      var frm = document.forms['merge'];
92      if (validate())
93      {
94        frm.submit();
95      }
96    }
97   
98    function selectPlateMappingOnClick()
99    {
100      var frm = document.forms['merge'];
101      var url = '../platemappings/index.jsp?ID=<%=ID%>&mode=selectone&callback=setPlateMappingCallback';
102      Main.openPopup(url, 'SelectPlateMapping', 1000, 700);
103    }
104    function setPlateMappingCallback(id, name)
105    {
106      var frm = document.forms['merge'];
107      var list = frm.platemapping_id;
108      if (list.length < 1 || list[0].value == '0') // >
109      {
110        Forms.addListOption(list, 0, new Option());
111      }
112      list[0].value = id;
113      list[0].text = name;
114      list.selectedIndex = 0;
115    }
116
117    function selectPlateTypeOnClick()
118    {
119      var frm = document.forms['merge'];
120      var url = '../platetypes/index.jsp?ID=<%=ID%>&mode=selectone&callback=setPlateTypeCallback';
121      Main.openPopup(url, 'SelectPlateType', 1000, 700);
122    }
123    function setPlateTypeCallback(id, name)
124    {
125      var frm = document.forms['merge'];
126      var list = frm.platetype_id;
127      if (list.length < 1 || list[0].value == '0') // >
128      {
129        Forms.addListOption(list, 0, new Option());
130      }
131      list[0].value = id;
132      list[0].text = name;
133      list.selectedIndex = 0;
134    }
135    </script>
136  </base:head>
137  <base:body>
138    <p>
139    <form action="merge_plates_2.jsp?ID=<%=ID%>" method="post" name="merge" onsubmit="return false;">
140
141    <h3 class="docked"><%=title%> <base:help helpid="plates.merge.1" /></h3>
142    <div class="boxed" style="<%="height: "+(int)(scale*280)+"px;"%>">
143      <table class="form" cellspacing=0>
144      <tr>
145        <td class="prompt">Plate mapping</td>
146        <td>
147          <base:select 
148            id="platemapping_id"
149            clazz="selectionlist required"
150            required="true"
151            current="<%=null%>"
152            recent="<%=recentPlateMappings%>"
153            newitem="true"
154            onselect="selectPlateMappingOnClick()"
155          />
156        </td>
157      </tr>
158      <tr>
159        <td class="prompt">Name</td>
160        <td><input <%=requiredClazz%> type="text" name="name" value="New plate" 
161          size="40" maxlength="<%=Plate.MAX_NAME_LENGTH%>"></td>
162      </tr>
163      <tr>
164        <td class="prompt">Plate type</td>
165        <td>
166          <base:select 
167            id="platetype_id"
168            clazz="selectionlist required"
169            required="true"
170            current="<%=null%>"
171            recent="<%=recentPlateTypes%>"
172            newitem="true"
173            onselect="selectPlateTypeOnClick()"
174          />
175        </td>
176      </tr>
177      </table>
178    </div>
179
180    <table align="center">
181    <tr>
182      <td width="50%"><base:button onclick="nextStep()" title="Next" /></td>
183      <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td>
184    </tr>
185    </table>
186
187    </form>
188  </base:body>
189  </base:page>
190  <%
191}
192finally
193{
194  if (dc != null) dc.close();
195}
196%>
Note: See TracBrowser for help on using the repository browser.