source: trunk/www/views/rawbioassays/edit_spotimages.jsp @ 5905

Last change on this file since 5905 was 5905, checked in by Nicklas Nordborg, 10 years ago

References #1655: GUI improvements

  • Use relative font sizes (em and %) instead of pixel values. This should make it possible to use relative values for everything and we don't have to split up into size_*.css


  • Removed "valign" attribute from lots of tables.


  • Removed "wrap" attribute from lots of texarea fields.


  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 10.9 KB
Line 
1<%-- $Id: edit_spotimages.jsp 5905 2011-12-12 08:42:09Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Häkkinen, 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 BASE. If not, see <http://www.gnu.org/licenses/>.
20  ------------------------------------------------------------------
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.DbControl"
29  import="net.sf.basedb.core.Item"
30  import="net.sf.basedb.core.SystemItems"
31  import="net.sf.basedb.core.ItemContext"
32  import="net.sf.basedb.core.Permission"
33  import="net.sf.basedb.core.RawBioAssay"
34  import="net.sf.basedb.core.SpotImages"
35  import="net.sf.basedb.core.File"
36  import="net.sf.basedb.core.PermissionDeniedException"
37  import="net.sf.basedb.core.BaseException"
38  import="net.sf.basedb.clients.web.Base"
39  import="net.sf.basedb.clients.web.util.HTML"
40  import="net.sf.basedb.util.Values"
41  import="java.util.List"
42  import="java.util.Set"
43  import="java.util.HashSet"
44%>
45<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
46<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
47<%
48final Item itemType = Item.RAWBIOASSAY;
49final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
50final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
51final int itemId = cc.getId();
52final String ID = sc.getId();
53final float scale = Base.getScale(sc);
54final DbControl dc = sc.newDbControl();
55try
56{
57  String title = "Create spot images";
58  RawBioAssay rawBioAssay = RawBioAssay.getById(dc, itemId);
59  SpotImages spi = rawBioAssay.getSpotImages();
60
61  if (!rawBioAssay.hasPermission(Permission.WRITE))
62  {
63    throw new PermissionDeniedException(Permission.WRITE, itemType.toString());
64  }
65  boolean readRedImageFile = true;
66  boolean readGreenImageFile = true;
67  boolean readBlueImageFile = true;
68  boolean readSpotImagesFile = true;
69  File redImageFile = null;
70  File greenImageFile = null;
71  File blueImageFile = null;
72  File spotImagesFile = null;
73  try
74  {
75    redImageFile = spi.getRedImageFile();
76  }
77  catch (PermissionDeniedException ex)
78  {
79    readRedImageFile = false;
80  }
81  try
82  {
83    greenImageFile = spi.getGreenImageFile();
84  }
85  catch (PermissionDeniedException ex)
86  {
87    readGreenImageFile = false;
88  }
89  try
90  {
91    blueImageFile = spi.getBlueImageFile();
92  }
93  catch (PermissionDeniedException ex)
94  {
95    readBlueImageFile = false;
96  }
97  try
98  {
99    spotImagesFile = spi.getSpotImagesFile();
100  }
101  catch (PermissionDeniedException ex)
102  {
103    readSpotImagesFile = false;
104  }
105 
106  final String clazz = "class=\"text\"";
107  final String requiredClazz = "class=\"text required\"";
108  %>
109
110  <base:page type="popup" title="<%=title%>">
111  <base:head scripts="tabcontrol.js,annotations.js" styles="tabcontrol.css">
112    <script language="JavaScript">
113    // Validate the "RawBioAssay" tab
114    function validateSpotImages()
115    {
116      var frm = document.forms['spotimages'];
117     
118      return true;
119    }
120    function selectRedFileOnClick()
121    {
122      var frm = document.forms['spotimages'];
123      var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setRedFileCallback';
124      url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(File.IMAGE)%>';
125      if (frm.redfile_id.length > 1) url += '&item_id='+frm.redfile_id[1].value;
126      Main.openPopup(url, 'SelectRedFile', 1000, 700);
127    }
128    function setRedFileCallback(fileId, name)
129    {
130      var frm = document.forms['spotimages'];
131      if (frm.redfile_id.length < 2) // >
132      {
133        frm.redfile_id[frm.redfile_id.length] = new Option();
134      }
135      frm.redfile_id[1].value = fileId;
136      frm.redfile_id[1].text = name;
137      frm.redfile_id.selectedIndex = 1;
138    }
139
140    function selectGreenFileOnClick()
141    {
142      var frm = document.forms['spotimages'];
143      var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setGreenFileCallback';
144      url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(File.IMAGE)%>';
145      if (frm.greenfile_id.length > 1) url += '&item_id='+frm.greenfile_id[1].value;
146      Main.openPopup(url, 'SelectGreenFile', 1000, 700);
147    }
148    function setGreenFileCallback(fileId, name)
149    {
150      var frm = document.forms['spotimages'];
151      if (frm.greenfile_id.length < 2) // >
152      {
153        frm.greenfile_id[frm.greenfile_id.length] = new Option();
154      }
155      frm.greenfile_id[1].value = fileId;
156      frm.greenfile_id[1].text = name;
157      frm.greenfile_id.selectedIndex = 1;
158    }
159   
160    function selectBlueFileOnClick()
161    {
162      var frm = document.forms['spotimages'];
163      var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setBlueFileCallback';
164      url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(File.IMAGE)%>';
165      if (frm.bluefile_id.length > 1) url += '&item_id='+frm.bluefile_id[1].value;
166      Main.openPopup(url, 'SelectBlueFile', 1000, 700);
167    }
168    function setBlueFileCallback(fileId, name)
169    {
170      var frm = document.forms['spotimages'];
171      if (frm.bluefile_id.length < 2) // >
172      {
173        frm.bluefile_id[frm.bluefile_id.length] = new Option();
174      }
175      frm.bluefile_id[1].value = fileId;
176      frm.bluefile_id[1].text = name;
177      frm.bluefile_id.selectedIndex = 1;
178    }
179
180    function browseOnClick()
181    {
182      Main.openPopup('../../filemanager/index.jsp?ID=<%=ID%>&cmd=SaveAs&callback=setSaveAsCallback', 'SaveAs', 1000, 700);
183    }
184    function setSaveAsCallback(path)
185    {
186      var frm = document.forms['spotimages'];
187      frm.path.value = path;
188    }
189
190    // Submit the form
191    function saveSettings()
192    {
193      var frm = document.forms['spotimages'];
194      frm.submit();
195    }
196
197    </script>
198  </base:head>
199  <base:body>
200    <p>
201    <form action="index.jsp?ID=<%=ID%>" method="post" name="spotimages" onsubmit="return false;">
202    <input type="hidden" name="item_id" value="<%=itemId%>">
203    <input type="hidden" name="cmd" value="CreateSpotImages">
204
205    <h3 class="docked"><%=title%> <base:help helpid="rawbioassay.edit.spotimages" /></h3>
206    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*340)+"px;"%>" 
207      position="bottom">
208    <t:tab id="info" title="Spot image parameters" validate="validateSpotImages()">
209      <table class="form" cellspacing=0>
210      <tr>
211        <td class="prompt">X scale</td>
212        <td><input type="text" <%=requiredClazz%> name="x_scale"
213          value="<%=spi.getXScale()%>" size="12" maxlength="10" 
214          onkeypress="return Numbers.integerOnly(event)"></td>
215
216        <td class="prompt">Y scale</td>
217        <td><input type="text" <%=requiredClazz%> name="y_scale"
218          value="<%=spi.getYScale()%>" size="12" maxlength="10" 
219          onkeypress="return Numbers.integerOnly(event)"></td>
220      </tr>
221      <tr>
222        <td class="prompt">X offset</td>
223        <td><input type="text" <%=requiredClazz%> name="x_offset" 
224          value="<%=spi.getXOffset()%>" size="12" maxlength="10" 
225          onkeypress="return Numbers.integerOnly(event)"></td>
226
227        <td class="prompt">Y offset</td>
228        <td><input type="text" <%=requiredClazz%> name="y_offset" 
229          value="<%=spi.getYOffset()%>" size="12" maxlength="10" 
230          onkeypress="return Numbers.integerOnly(event)"></td>
231      </tr>
232      <tr>
233        <td class="prompt">Spot size</td>
234        <td><input type="text" <%=requiredClazz%> name="spotsize"
235          value="<%=spi.getSpotsize()%>" size="12" maxlength="10" 
236          onkeypress="return Numbers.integerOnly(event)"></td>
237
238        <td class="prompt">Gamma correction</td>
239        <td><input type="text" <%=requiredClazz%> name="gamma"
240          value="<%=spi.getGamma()%>" size="12" maxlength="10" 
241          onkeypress="return Numbers.numberOnly(event)"></td>
242      </tr>
243      <tr>
244        <td class="prompt">Quality</td>
245        <td><input type="text" <%=requiredClazz%> name="quality" 
246          value="<%=spi.getQuality()%>" size="12" maxlength="10" 
247          onkeypress="return Numbers.integerOnly(event)"></td>
248      </tr>
249
250      <tr>
251        <td class="prompt">Red image file</td>
252        <td colspan="3">
253          <table border="0" cellspacing="0" cellpadding="0">
254          <tr>
255          <td>
256            <select name="redfile_id" size="1" 
257              style="width: 20em;">
258              <option value="0">- none -
259              <%
260              if (redImageFile != null)
261              {
262                %>
263                <option value="<%=redImageFile.getId()%>" selected><%=HTML.encodeTags(redImageFile.getPath().toString())%>
264                <%
265              }
266              %>
267            </select>
268            &nbsp;
269          </td>
270          <td><base:button onclick="selectRedFileOnClick()" title="Select&hellip;" /></td>
271          </tr>
272          </table>
273        </td>
274      </tr>
275
276      <tr>
277        <td class="prompt">Green image file</td>
278        <td colspan="3">
279          <table border="0" cellspacing="0" cellpadding="0">
280          <tr>
281          <td>
282            <select name="greenfile_id" size="1" 
283              style="width: 20em;">
284              <option value="0">- none -
285              <%
286              if (greenImageFile != null)
287              {
288                %>
289                <option value="<%=greenImageFile.getId()%>" selected><%=HTML.encodeTags(greenImageFile.getPath().toString())%>
290                <%
291              }
292              %>
293            </select>
294            &nbsp;
295          </td>
296          <td><base:button onclick="selectGreenFileOnClick()" title="Select&hellip;" /></td>
297          </tr>
298          </table>
299        </td>
300      </tr>
301
302      <tr>
303        <td class="prompt">Blue image file</td>
304        <td colspan="3">
305          <table border="0" cellspacing="0" cellpadding="0">
306          <tr>
307          <td>
308            <select name="bluefile_id" size="1" 
309              style="width: 20em;">
310              <option value="0">- none -
311              <%
312              if (blueImageFile != null)
313              {
314                %>
315                <option value="<%=blueImageFile.getId()%>" selected><%=HTML.encodeTags(blueImageFile.getPath().toString())%>
316                <%
317              }
318              %>
319            </select>
320            &nbsp;
321          </td>
322          <td><base:button onclick="selectBlueFileOnClick()" title="Select&hellip;" /></td>
323          </tr>
324          </table>
325        </td>
326      </tr>
327     
328      <tr >
329        <td class="prompt">Save as</td>
330        <td colspan="3">
331          <table>
332          <tr>
333          <td><input type="text" class="text required" 
334            name="path" size="40" 
335            value="<%=spotImagesFile == null ? "" : HTML.encodeTags(spotImagesFile.getPath().toString())%>"></td>
336          <td><base:button 
337              title="Browse..."
338              onclick="browseOnClick()"
339              />
340          </td>
341          </tr>
342          </table>
343          <input type="checkbox" name="overwrite" id="overwrite" value="1"><label for="overwrite">Overwrite existing file</label>
344        </td>
345      </tr>
346      </table>
347      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
348    </t:tab>
349    </t:tabcontrol>
350
351    <table align="center">
352    <tr>
353      <td width="50%"><base:button onclick="saveSettings()" title="Create" image="ok.png"/></td>
354      <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td>
355    </tr>
356    </table>
357    </form>
358  </base:body>
359  </base:page>
360  <%
361}
362finally
363{
364  if (dc != null) dc.close();
365}
366%>
Note: See TracBrowser for help on using the repository browser.