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

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

References #1729 and #1730. Several edit dialogs in the 'View' menu. Expression builder, which required changes to the 'Validate' function which is now done on the server side instead of in the browser (due to the use of eval() on user input).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 8.2 KB
Line 
1<%-- $Id: edit_spotimages.jsp 6314 2013-09-02 12:47:53Z 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  <base:page type="popup" title="<%=title%>">
107  <base:head scripts="~spotimages.js" />
108  <base:body>
109    <h1><%=title%> <base:help helpid="rawbioassay.edit.spotimages" /></h1>
110   
111    <div id="page-data" class="datacontainer"
112      data-image-file-type="<%=SystemItems.getId(File.IMAGE)%>"
113    ></div>
114   
115    <form action="index.jsp?ID=<%=ID%>" method="post" name="spotimages">
116    <input type="hidden" name="item_id" value="<%=itemId%>">
117    <input type="hidden" name="cmd" value="CreateSpotImages">
118
119    <div class="content filled bottomborder">
120      <table class="fullform input100">
121      <tbody class="sectionheader">
122        <tr>
123          <th colspan="4">Scale, offset, etc. for the spots</th>
124        </tr>
125      </tbody>
126      <tbody>
127      <tr>
128        <th>X scale</th>
129        <td><input type="text" class="text required auto-init" data-auto-init="integer-only"
130          name="x_scale" style="width: 8em;"
131          value="<%=spi.getXScale()%>" maxlength="10" ></td>
132
133        <th class="leftborder">Y scale</th>
134        <td><input type="text" class="text required auto-init" data-auto-init="integer-only"
135          name="y_scale" style="width: 8em;"
136          value="<%=spi.getYScale()%>" maxlength="10"></td>
137      </tr>
138      <tr>
139        <th>X offset</th>
140        <td><input type="text" class="text required auto-init" data-auto-init="integer-only"
141          name="x_offset" style="width: 8em;"
142          value="<%=spi.getXOffset()%>" maxlength="10"></td>
143
144        <th class="leftborder">Y offset</th>
145        <td><input type="text" class="text required auto-init" data-auto-init="integer-only"
146          name="y_offset" style="width: 8em;"
147          value="<%=spi.getYOffset()%>" maxlength="10"></td>
148      </tr>
149      <tr>
150        <th>Spot size</th>
151        <td><input type="text" class="text required auto-init" data-auto-init="integer-only"
152          name="spotsize" style="width: 8em;"
153          value="<%=spi.getSpotsize()%>" maxlength="10"></td>
154
155        <th class="leftborder">Gamma correction</th>
156        <td><input type="text" class="text required auto-init" data-auto-init="number-only" 
157          name="gamma" style="width: 8em;"
158          value="<%=spi.getGamma()%>" maxlength="10"></td>
159      </tr>
160      <tr>
161        <th>Quality</th>
162        <td><input type="text" class="text required auto-init" data-auto-init="integer-only"
163          name="quality" style="width: 8em;"
164          value="<%=spi.getQuality()%>" maxlength="10"></td>
165        <th class="leftborder"></th>
166        <td></td>
167      </tr>
168      </tbody>
169      <tbody class="sectionheader">
170        <tr>
171          <th colspan="4">Raw image files</th>
172        </tr>
173      </tbody>
174      <tbody>
175      <tr>
176        <th>Red image file</th>
177        <td colspan="3">
178          <table>
179          <tr>
180          <td>
181            <select name="redfile_id" id="redfile_id" style="width: 25em;">
182              <option value="0">- none -
183              <%
184              if (redImageFile != null)
185              {
186                %>
187                <option value="<%=redImageFile.getId()%>" selected><%=HTML.encodeTags(redImageFile.getPath().toString())%>
188                <%
189              }
190              %>
191            </select>
192          </td>
193          <td><base:button id="btnRedFile" data-select="redfile_id" title="Select&hellip;" /></td>
194          </tr>
195          </table>
196        </td>
197      </tr>
198
199      <tr>
200        <th>Green image file</th>
201        <td colspan="3">
202          <table>
203          <tr>
204          <td>
205            <select name="greenfile_id" id="greenfile_id" style="width: 25em;">
206              <option value="0">- none -
207              <%
208              if (greenImageFile != null)
209              {
210                %>
211                <option value="<%=greenImageFile.getId()%>" selected><%=HTML.encodeTags(greenImageFile.getPath().toString())%>
212                <%
213              }
214              %>
215            </select>
216          </td>
217          <td><base:button id="btnGreenFile" data-select="greenfile_id" title="Select&hellip;" /></td>
218          </tr>
219          </table>
220        </td>
221      </tr>
222
223      <tr>
224        <th>Blue image file</th>
225        <td colspan="3">
226          <table>
227          <tr>
228          <td>
229            <select name="bluefile_id" id="bluefile_id" style="width: 25em;">
230              <option value="0">- none -
231              <%
232              if (blueImageFile != null)
233              {
234                %>
235                <option value="<%=blueImageFile.getId()%>" selected><%=HTML.encodeTags(blueImageFile.getPath().toString())%>
236                <%
237              }
238              %>
239            </select>
240          </td>
241          <td><base:button id="btnBlueFile" data-select="bluefile_id" title="Select&hellip;" /></td>
242          </tr>
243          </table>
244        </td>
245      </tr>
246     
247      <tr >
248        <th>Save as</th>
249        <td colspan="3">
250          <table style="width: 100%;">
251          <tr>
252          <td style="width: 98%;"><input type="text" class="text required" 
253            name="path" id="path"
254            value="<%=spotImagesFile == null ? "" : HTML.encodeTags(spotImagesFile.getPath().toString())%>"></td>
255          <td ><base:button id="btnBrowse" title="Browse..." />
256          </td>
257          </tr>
258          </table>
259        </td>
260      </tr>
261      <tr>
262        <th class="subprompt"></th>
263        <td colspan="3"><input type="checkbox" name="overwrite" id="overwrite" value="1"><label for="overwrite">Overwrite existing file</label></td>
264      </tr>
265      <tr class="dynamic">
266        <th></th>
267        <td colspan="3"></td>
268      </tr>
269      </tbody>
270      </table>
271    </div>
272    </form>
273
274    <div class="legend">
275      <base:icon image="required.png" />= required information
276    </div>
277
278    <base:buttongroup subclass="dialogbuttons">
279      <base:button id="btnSave" title="Create" image="ok.png"/>
280      <base:button id="close" title="Cancel" />
281    </base:buttongroup>
282  </base:body>
283  </base:page>
284  <%
285}
286finally
287{
288  if (dc != null) dc.close();
289}
290%>
Note: See TracBrowser for help on using the repository browser.