source: trunk/www/lims/plates/wells/edit_well.jsp @ 4626

Last change on this file since 4626 was 4626, checked in by Nicklas Nordborg, 13 years ago

Fixes #1164: Reporter importer plug-in displays 'Reporter ID' when setting column mappings... should be 'External ID'

Decided to keep 'Reporter ID' on other plug-ins and only calrify the description since if using 'External ID' it is not clear what this references (eg. spot external id, feature external id...)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 6.2 KB
Line 
1<%-- $Id: edit_well.jsp 4626 2008-11-05 09:56:12Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Hakkinen, Nicklas Nordborg, Martin Svensson
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 BASE. If not, see <http://www.gnu.org/licenses/>.
20  ------------------------------------------------------------------
21  @author Nicklas
22  @version 2.0
23--%>
24<%@ page session="false"
25  import="net.sf.basedb.core.SessionControl"
26  import="net.sf.basedb.core.DbControl"
27  import="net.sf.basedb.core.Item"
28  import="net.sf.basedb.core.ItemContext"
29  import="net.sf.basedb.core.Permission"
30  import="net.sf.basedb.core.Well"
31  import="net.sf.basedb.core.Plate"
32  import="net.sf.basedb.core.PermissionDeniedException"
33  import="net.sf.basedb.core.data.ReporterData"
34  import="net.sf.basedb.core.BaseException"
35  import="net.sf.basedb.clients.web.Base"
36  import="net.sf.basedb.clients.web.util.HTML"
37  import="net.sf.basedb.util.Values"
38%>
39<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
40<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
41<%
42final Item itemType = Item.WELL;
43final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
44final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
45final int itemId = cc.getId();
46final int plateId = Values.getInt(request.getParameter("plate_id"));
47final String ID = sc.getId();
48final float scale = Base.getScale(sc);
49final DbControl dc = sc.newDbControl();
50try
51{
52  String title = null;
53  Well well = Well.getById(dc, itemId);
54  Plate plate = well.getPlate();
55  ReporterData reporter = well.getReporter();
56 
57  title = "Edit well -- [" + well.getRow() + ", " + well.getColumn() + "] on plate " + HTML.encodeTags(plate.getName());
58
59  final String clazz = "class=\"text\"";
60  final String requiredClazz = "class=\"text required\"";
61 
62  if (well != null && !well.hasPermission(Permission.WRITE))
63  {
64    throw new PermissionDeniedException(Permission.WRITE, itemType.toString());
65  }
66
67  cc.setObject("item", well);
68  %>
69
70  <base:page type="popup" title="<%=title%>">
71  <base:head scripts="tabcontrol.js,annotations.js" styles="tabcontrol.css">
72    <script language="JavaScript">
73    // Validate the "Well" tab
74    function validateWell()
75    {
76      var frm = document.forms['well'];
77      return true;
78    }
79
80    // Submit the form
81    function saveSettings()
82    {
83      var frm = document.forms['well'];
84      if (TabControl.validateActiveTab('settings'))
85      {
86        if (annotationsLoaded)
87        {
88          Annotations.addModifiedAnnotationsToForm(frames.annotations, frm);
89        }
90        if (inheritedAnnotationsLoaded)
91        {
92          Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm);
93        }
94        frm.submit();
95      }
96    }
97   
98    var annotationsLoaded = false;
99    var inheritedAnnotationsLoaded = false;
100    var parentsChanged = false;
101    function switchTab(tabControlId, tabId)
102    {
103      if (TabControl.setActiveTab(tabControlId, tabId))
104      {
105        if (tabId == 'annotations' && !annotationsLoaded)
106        {
107          Annotations.loadAnnotateFrame(frames.annotations, '<%=ID%>', '<%=itemType.name()%>', <%=well == null ? 0 : well.getId()%>);
108          annotationsLoaded = true;
109        }
110        else if (tabId == 'inheritedAnnotations' && 
111          (parentsChanged || !inheritedAnnotationsLoaded))
112        {
113          Annotations.loadInheritFrame(frames.inheritedAnnotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getParents());
114          inheritedAnnotationsLoaded = true;
115          parentsChanged = false;
116        }
117      }
118    }
119    function getParents()
120    {
121      return new Array();
122    }
123    </script>
124  </base:head>
125  <base:body>
126    <p>
127    <form action="index.jsp?ID=<%=ID%>" method="post" name="well" onsubmit="return false;">
128    <input type="hidden" name="cmd" value="UpdateItem">
129    <input type="hidden" name="plate_id" value="<%=plateId%>">
130
131    <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3>
132    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" 
133      position="bottom" switch="switchTab">
134    <t:tab id="info" title="Well" validate="validateWell()" helpid="well.edit">
135      <table class="form" cellspacing=0>
136      <tr>
137        <td class="prompt">Plate</td>
138        <td><%=HTML.encodeTags(plate.getName())%></td>
139      </tr>
140      <tr>
141        <td class="prompt">Coordinate</td>
142        <td>[<%=well.getRow()%>, <%=well.getColumn()%>]</td>
143      </tr>
144      <tr>
145        <td class="prompt">Reporter name</td>
146        <td><%=reporter == null ? "<i>- none -</i>" : HTML.encodeTags(reporter.getName())%></td>
147      </tr>
148      <tr>
149        <td class="prompt">Reporter External ID</td>
150        <td><%=reporter == null ? "<i>- none -</i>" : HTML.encodeTags(reporter.getExternalId())%></td>
151      </tr>
152      </table>
153      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
154    </t:tab>
155
156    <t:tab id="annotations" title="Annotations" helpid="annotations.edit">
157      <iframe name="annotations" id="idAnnotations" src="../../../common/annotations/wait.jsp" 
158        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
159        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
160    </t:tab>
161   
162    <t:tab id="inheritedAnnotations" title="Inherited annotations" helpid="annotations.edit.inherited">
163   
164      <iframe name="inheritedAnnotations" id="idInheritedAnnotations" src="../../../common/annotations/wait.jsp" 
165        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
166        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
167    </t:tab>
168    </t:tabcontrol>
169
170    <table align="center">
171    <tr>
172      <td width="50%"><base:button onclick="saveSettings()" title="Save" /></td>
173      <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td>
174    </tr>
175    </table>
176    </form>
177  </base:body>
178  </base:page>
179  <%
180}
181finally
182{
183  if (dc != null) dc.close();
184}
185%>
Note: See TracBrowser for help on using the repository browser.