www/lims/plates/merge_plates_2.jsp

Code
Comments
Other
Rev Date Author Line
1660 24 Nov 05 nicklas 1 <%-- $Id$
1660 24 Nov 05 nicklas 2   ------------------------------------------------------------------
3675 16 Aug 07 jari 3   Copyright (C) 2005 Nicklas Nordborg
5425 23 Sep 10 nicklas 4   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
1660 24 Nov 05 nicklas 5
2304 22 May 06 jari 6   This file is part of BASE - BioArray Software Environment.
2304 22 May 06 jari 7   Available at http://base.thep.lu.se/
1660 24 Nov 05 nicklas 8
1660 24 Nov 05 nicklas 9   BASE is free software; you can redistribute it and/or
1660 24 Nov 05 nicklas 10   modify it under the terms of the GNU General Public License
4476 05 Sep 08 jari 11   as published by the Free Software Foundation; either version 3
1660 24 Nov 05 nicklas 12   of the License, or (at your option) any later version.
1660 24 Nov 05 nicklas 13
1660 24 Nov 05 nicklas 14   BASE is distributed in the hope that it will be useful,
1660 24 Nov 05 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
1660 24 Nov 05 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1660 24 Nov 05 nicklas 17   GNU General Public License for more details.
1660 24 Nov 05 nicklas 18
1660 24 Nov 05 nicklas 19   You should have received a copy of the GNU General Public License
4511 11 Sep 08 jari 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
1660 24 Nov 05 nicklas 21   ------------------------------------------------------------------
1660 24 Nov 05 nicklas 22
1660 24 Nov 05 nicklas 23
1660 24 Nov 05 nicklas 24   @author Nicklas
1660 24 Nov 05 nicklas 25   @version 2.0
1660 24 Nov 05 nicklas 26 --%>
5426 24 Sep 10 nicklas 27 <%@ page pageEncoding="UTF-8" session="false"
1660 24 Nov 05 nicklas 28   import="net.sf.basedb.core.SessionControl"
1660 24 Nov 05 nicklas 29   import="net.sf.basedb.core.DbControl"
1660 24 Nov 05 nicklas 30   import="net.sf.basedb.core.Item"
1660 24 Nov 05 nicklas 31   import="net.sf.basedb.core.Permission"
1660 24 Nov 05 nicklas 32   import="net.sf.basedb.core.Plate"
1660 24 Nov 05 nicklas 33   import="net.sf.basedb.core.PlateMapping"
1660 24 Nov 05 nicklas 34   import="net.sf.basedb.core.PlateType"
1847 26 Jan 06 nicklas 35   import="net.sf.basedb.core.PlateGeometry"
1660 24 Nov 05 nicklas 36   import="net.sf.basedb.core.BaseException"
1660 24 Nov 05 nicklas 37   import="net.sf.basedb.clients.web.Base"
1660 24 Nov 05 nicklas 38   import="net.sf.basedb.clients.web.WebException"
1660 24 Nov 05 nicklas 39   import="net.sf.basedb.clients.web.util.HTML"
2753 20 Oct 06 nicklas 40   import="net.sf.basedb.util.Values"
1660 24 Nov 05 nicklas 41 %>
1660 24 Nov 05 nicklas 42 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
1660 24 Nov 05 nicklas 43 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
1660 24 Nov 05 nicklas 44 <%
1660 24 Nov 05 nicklas 45 final Item itemType = Item.PLATE;
1660 24 Nov 05 nicklas 46 final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.CREATE, itemType);
1660 24 Nov 05 nicklas 47 final String ID = sc.getId();
1660 24 Nov 05 nicklas 48 final float scale = Base.getScale(sc);
7954 12 May 21 nicklas 49 final DbControl dc = sc.newDbControl(":Merge plates wizard step 2");
1660 24 Nov 05 nicklas 50 try
1660 24 Nov 05 nicklas 51 {
1660 24 Nov 05 nicklas 52   final int plateMappingId = Values.getInt(request.getParameter("platemapping_id"));
1660 24 Nov 05 nicklas 53   final int plateTypeId = Values.getInt(request.getParameter("platetype_id"));
1660 24 Nov 05 nicklas 54   final PlateMapping plateMapping = PlateMapping.getById(dc, plateMappingId);
1660 24 Nov 05 nicklas 55   final PlateType plateType = PlateType.getById(dc, plateTypeId);
1847 26 Jan 06 nicklas 56   PlateGeometry sourceGeometry = plateMapping.getSourceGeometry();
1660 24 Nov 05 nicklas 57   
1660 24 Nov 05 nicklas 58   if (!plateMapping.getDestinationGeometry().equals(plateType.getPlateGeometry()))
1660 24 Nov 05 nicklas 59   {
1660 24 Nov 05 nicklas 60     throw new WebException("popup", "Incomatible plate type and plate mapping", 
1660 24 Nov 05 nicklas 61       "The selected plate type has a different geometry than the mapping.");
1660 24 Nov 05 nicklas 62   }
1660 24 Nov 05 nicklas 63   
1660 24 Nov 05 nicklas 64   String title = "Merge plates -- step 2 of 2 -- Select plates";
1660 24 Nov 05 nicklas 65   %>
6312 28 Aug 13 nicklas 66   <base:page type="popup" title="<%=title%>" id="step-2">
6312 28 Aug 13 nicklas 67   <base:head scripts="linkitems-2.js,~merge_plates.js" />
1660 24 Nov 05 nicklas 68   <base:body>
5920 10 Jan 12 nicklas 69     <h1><%=title%> <base:help helpid="plates.merge.2" /></h1>
5920 10 Jan 12 nicklas 70
6312 28 Aug 13 nicklas 71     <div id="page-data" class="datacontainer"
6312 28 Aug 13 nicklas 72       data-source-count="<%=plateMapping.getSourceCount()%>"
6312 28 Aug 13 nicklas 73     ></div>
6312 28 Aug 13 nicklas 74
6162 10 Oct 12 nicklas 75     <form action="index.jsp?ID=<%=ID%>" method="post" name="merge">
1660 24 Nov 05 nicklas 76     <input type="hidden" name="cmd" value="MergePlates">
1660 24 Nov 05 nicklas 77     <input type="hidden" name="platemapping_id" value="<%=plateMappingId%>">
1660 24 Nov 05 nicklas 78     <input type="hidden" name="platetype_id" value="<%=plateTypeId%>">
1660 24 Nov 05 nicklas 79
5920 10 Jan 12 nicklas 80     <div class="content bottomborder">
5920 10 Jan 12 nicklas 81       <table class="fullform input100 smaller">
5920 10 Jan 12 nicklas 82       <tr>
5920 10 Jan 12 nicklas 83         <th>Plate mapping</th>
5920 10 Jan 12 nicklas 84         <td>
5920 10 Jan 12 nicklas 85           <table><tr>
5920 10 Jan 12 nicklas 86             <td><%=HTML.encodeTags(plateMapping.getName())%></td>
1660 24 Nov 05 nicklas 87           <%
1660 24 Nov 05 nicklas 88           if (plateMapping.getImage() !=  null)
1660 24 Nov 05 nicklas 89           {
1660 24 Nov 05 nicklas 90             %>
6146 21 Sep 12 nicklas 91             <td><img src="../../images/platemappings/<%=plateMapping.getImage()%>" alt=""></td>
1660 24 Nov 05 nicklas 92             <%
1660 24 Nov 05 nicklas 93           }
1660 24 Nov 05 nicklas 94           %>
5920 10 Jan 12 nicklas 95           </tr></table>
1660 24 Nov 05 nicklas 96         </td>
1660 24 Nov 05 nicklas 97       </tr>
1660 24 Nov 05 nicklas 98       <tr>
5920 10 Jan 12 nicklas 99         <th>Name</th>
6217 14 Dec 12 nicklas 100         <td><input class="text required" type="text" name="name" value="<%=HTML.encodeTags(request.getParameter("name"))%>" 
5920 10 Jan 12 nicklas 101           maxlength="<%=Plate.MAX_NAME_LENGTH%>"></td>
1660 24 Nov 05 nicklas 102       </tr>
1660 24 Nov 05 nicklas 103       <tr>
5920 10 Jan 12 nicklas 104         <th>Plate type</th>
1660 24 Nov 05 nicklas 105         <td><%=HTML.encodeTags(plateType.getName())%></td>
1660 24 Nov 05 nicklas 106       </tr>
5920 10 Jan 12 nicklas 107       <tr class="big">
5920 10 Jan 12 nicklas 108         <th>Plates</th>
1660 24 Nov 05 nicklas 109         <td>
5920 10 Jan 12 nicklas 110         <table>
5920 10 Jan 12 nicklas 111         <tr>
5920 10 Jan 12 nicklas 112           <td style="padding: 5px;">
5920 10 Jan 12 nicklas 113             <base:buttongroup vertical="true">
5920 10 Jan 12 nicklas 114               <base:button
6312 28 Aug 13 nicklas 115                 id="moveUp"
6312 28 Aug 13 nicklas 116                 data-down="0"
5920 10 Jan 12 nicklas 117                 image="move_up.png" 
5920 10 Jan 12 nicklas 118                 tooltip="Move up" 
5920 10 Jan 12 nicklas 119                 subclass="square"
5920 10 Jan 12 nicklas 120               />
5920 10 Jan 12 nicklas 121               <base:button 
6312 28 Aug 13 nicklas 122                 id="moveDown"
6312 28 Aug 13 nicklas 123                 data-down="1"
5920 10 Jan 12 nicklas 124                 image="move_down.png" 
5920 10 Jan 12 nicklas 125                 tooltip="Move down" 
5920 10 Jan 12 nicklas 126                 subclass="square"
5920 10 Jan 12 nicklas 127               />
5920 10 Jan 12 nicklas 128             </base:buttongroup>
1660 24 Nov 05 nicklas 129           </td>
1660 24 Nov 05 nicklas 130           <td>
6312 28 Aug 13 nicklas 131             <select name="plates" id="plates" 
6312 28 Aug 13 nicklas 132               class="auto-init"
6312 28 Aug 13 nicklas 133               data-auto-init="link-container"
6312 28 Aug 13 nicklas 134               size="<%=Math.max(5, plateMapping.getSourceCount())%>" 
6312 28 Aug 13 nicklas 135               multiple style="width: 15em;" class="required">
1660 24 Nov 05 nicklas 136             </select>
1660 24 Nov 05 nicklas 137           </td>
1660 24 Nov 05 nicklas 138           <td>
5920 10 Jan 12 nicklas 139             <base:buttongroup vertical="true">
5920 10 Jan 12 nicklas 140               <base:button 
6312 28 Aug 13 nicklas 141                 subclass="leftaligned auto-init"
6312 28 Aug 13 nicklas 142                 data-auto-init="add-link"
6312 28 Aug 13 nicklas 143                 data-list-id="plates"
6312 28 Aug 13 nicklas 144                 data-item-type="PLATE"
6312 28 Aug 13 nicklas 145                 data-extra-url="<%="&resetTemporary=1&tmpfilter:INT:plateType.plateGeometry="+sourceGeometry.getId()%>" 
5920 10 Jan 12 nicklas 146                 style="width: 14em;"
5920 10 Jan 12 nicklas 147                 title="Add&nbsp;plates&hellip;" 
5920 10 Jan 12 nicklas 148                 tooltip="Add plates to be used"
5920 10 Jan 12 nicklas 149               />
5920 10 Jan 12 nicklas 150               <base:button 
6312 28 Aug 13 nicklas 151                 subclass="leftaligned auto-init"
6312 28 Aug 13 nicklas 152                 data-auto-init="remove-link"
6312 28 Aug 13 nicklas 153                 data-list-id="plates"
5920 10 Jan 12 nicklas 154                 style="width: 14em;"
5920 10 Jan 12 nicklas 155                 title="Remove" 
5920 10 Jan 12 nicklas 156                 tooltip="Remove the selected plates"
5920 10 Jan 12 nicklas 157               />
5920 10 Jan 12 nicklas 158             </base:buttongroup>
1660 24 Nov 05 nicklas 159           </td>
1660 24 Nov 05 nicklas 160           </tr>
1660 24 Nov 05 nicklas 161           </table>
1660 24 Nov 05 nicklas 162         </td>
1660 24 Nov 05 nicklas 163       </tr>
5920 10 Jan 12 nicklas 164       <tr class="dynamic">
5920 10 Jan 12 nicklas 165         <th></th>
5920 10 Jan 12 nicklas 166         <td></td>
5920 10 Jan 12 nicklas 167       </tr>
1660 24 Nov 05 nicklas 168       </table>
1660 24 Nov 05 nicklas 169     </div>
5920 10 Jan 12 nicklas 170     </form>
5920 10 Jan 12 nicklas 171     
5920 10 Jan 12 nicklas 172     <div class="legend">
5946 03 Feb 12 nicklas 173       <base:icon image="required.png" />= required information
5920 10 Jan 12 nicklas 174     </div>
5920 10 Jan 12 nicklas 175     
5920 10 Jan 12 nicklas 176     <base:buttongroup subclass="dialogbuttons">
6312 28 Aug 13 nicklas 177       <base:button id="btnMerge" title="Merge" image="gonext.png"/>
6312 28 Aug 13 nicklas 178       <base:button id="close" title="Cancel" />
5920 10 Jan 12 nicklas 179     </base:buttongroup>
1660 24 Nov 05 nicklas 180
1660 24 Nov 05 nicklas 181   </base:body>
1660 24 Nov 05 nicklas 182   </base:page>
1660 24 Nov 05 nicklas 183   <%
1660 24 Nov 05 nicklas 184 }
1660 24 Nov 05 nicklas 185 finally
1660 24 Nov 05 nicklas 186 {
1660 24 Nov 05 nicklas 187   if (dc != null) dc.close();
1660 24 Nov 05 nicklas 188 }
1660 24 Nov 05 nicklas 189 %>