1812 |
24 Jan 06 |
nicklas |
1 |
<%-- $Id$ |
1812 |
24 Jan 06 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
1812 |
24 Jan 06 |
nicklas |
4 |
|
2304 |
22 May 06 |
jari |
5 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
6 |
Available at http://base.thep.lu.se/ |
1812 |
24 Jan 06 |
nicklas |
7 |
|
1812 |
24 Jan 06 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
1812 |
24 Jan 06 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
10 |
as published by the Free Software Foundation; either version 3 |
1812 |
24 Jan 06 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1812 |
24 Jan 06 |
nicklas |
12 |
|
1812 |
24 Jan 06 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
1812 |
24 Jan 06 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1812 |
24 Jan 06 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1812 |
24 Jan 06 |
nicklas |
16 |
GNU General Public License for more details. |
1812 |
24 Jan 06 |
nicklas |
17 |
|
1812 |
24 Jan 06 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
4511 |
11 Sep 08 |
jari |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1812 |
24 Jan 06 |
nicklas |
20 |
------------------------------------------------------------------ |
1812 |
24 Jan 06 |
nicklas |
21 |
|
1812 |
24 Jan 06 |
nicklas |
22 |
|
1812 |
24 Jan 06 |
nicklas |
23 |
@author Nicklas |
1812 |
24 Jan 06 |
nicklas |
24 |
@version 2.0 |
1812 |
24 Jan 06 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
1812 |
24 Jan 06 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
1812 |
24 Jan 06 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
1812 |
24 Jan 06 |
nicklas |
29 |
import="net.sf.basedb.core.Item" |
1812 |
24 Jan 06 |
nicklas |
30 |
import="net.sf.basedb.core.ItemContext" |
1812 |
24 Jan 06 |
nicklas |
31 |
import="net.sf.basedb.core.SystemItems" |
1812 |
24 Jan 06 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
1812 |
24 Jan 06 |
nicklas |
33 |
import="net.sf.basedb.core.Include" |
1812 |
24 Jan 06 |
nicklas |
34 |
import="net.sf.basedb.core.ArraySlide" |
1812 |
24 Jan 06 |
nicklas |
35 |
import="net.sf.basedb.core.ArrayBatch" |
1812 |
24 Jan 06 |
nicklas |
36 |
import="net.sf.basedb.core.ItemQuery" |
1812 |
24 Jan 06 |
nicklas |
37 |
import="net.sf.basedb.core.ItemResultList" |
1812 |
24 Jan 06 |
nicklas |
38 |
import="net.sf.basedb.core.PermissionDeniedException" |
1812 |
24 Jan 06 |
nicklas |
39 |
import="net.sf.basedb.core.BaseException" |
1812 |
24 Jan 06 |
nicklas |
40 |
import="net.sf.basedb.core.query.Orders" |
1812 |
24 Jan 06 |
nicklas |
41 |
import="net.sf.basedb.core.query.Hql" |
1812 |
24 Jan 06 |
nicklas |
42 |
import="net.sf.basedb.clients.web.Base" |
1812 |
24 Jan 06 |
nicklas |
43 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
44 |
import="net.sf.basedb.util.Values" |
5498 |
17 Nov 10 |
nicklas |
45 |
import="net.sf.basedb.core.plugin.GuiContext" |
5498 |
17 Nov 10 |
nicklas |
46 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5498 |
17 Nov 10 |
nicklas |
47 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5498 |
17 Nov 10 |
nicklas |
48 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
49 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5498 |
17 Nov 10 |
nicklas |
50 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
1812 |
24 Jan 06 |
nicklas |
51 |
import="java.util.List" |
1812 |
24 Jan 06 |
nicklas |
52 |
import="java.util.Set" |
1812 |
24 Jan 06 |
nicklas |
53 |
import="java.util.HashSet" |
1812 |
24 Jan 06 |
nicklas |
54 |
import="java.util.Date" |
1812 |
24 Jan 06 |
nicklas |
55 |
%> |
1812 |
24 Jan 06 |
nicklas |
56 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1812 |
24 Jan 06 |
nicklas |
57 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6146 |
21 Sep 12 |
nicklas |
58 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
1812 |
24 Jan 06 |
nicklas |
59 |
<% |
1812 |
24 Jan 06 |
nicklas |
60 |
final Item itemType = Item.ARRAYSLIDE; |
1812 |
24 Jan 06 |
nicklas |
61 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1812 |
24 Jan 06 |
nicklas |
62 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1812 |
24 Jan 06 |
nicklas |
63 |
final int itemId = cc.getId(); |
1812 |
24 Jan 06 |
nicklas |
64 |
final String ID = sc.getId(); |
1812 |
24 Jan 06 |
nicklas |
65 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
66 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
1812 |
24 Jan 06 |
nicklas |
67 |
try |
1812 |
24 Jan 06 |
nicklas |
68 |
{ |
1812 |
24 Jan 06 |
nicklas |
69 |
String title = null; |
1812 |
24 Jan 06 |
nicklas |
70 |
ArraySlide slide = null; |
1812 |
24 Jan 06 |
nicklas |
71 |
|
1812 |
24 Jan 06 |
nicklas |
72 |
boolean readCurrentArrayBatch = true; |
1812 |
24 Jan 06 |
nicklas |
73 |
ArrayBatch currentArrayBatch = null; |
2449 |
29 Jun 06 |
nicklas |
74 |
int maxIndex = 0; |
2598 |
28 Aug 06 |
nicklas |
75 |
|
2598 |
28 Aug 06 |
nicklas |
76 |
// Load recently used items |
7605 |
26 Feb 19 |
nicklas |
77 |
List<ArrayBatch> recentArrayBatches = cc.getRecent(dc, Item.ARRAYBATCH); |
1812 |
24 Jan 06 |
nicklas |
78 |
|
1812 |
24 Jan 06 |
nicklas |
79 |
if (itemId == 0) |
1812 |
24 Jan 06 |
nicklas |
80 |
{ |
1812 |
24 Jan 06 |
nicklas |
81 |
title = "Create array slide"; |
1812 |
24 Jan 06 |
nicklas |
82 |
cc.removeObject("item"); |
2449 |
29 Jun 06 |
nicklas |
83 |
int arrayBatchId = Values.getInt(request.getParameter("arraybatch_id")); |
2449 |
29 Jun 06 |
nicklas |
84 |
if (arrayBatchId != 0) |
1812 |
24 Jan 06 |
nicklas |
85 |
{ |
2449 |
29 Jun 06 |
nicklas |
86 |
currentArrayBatch = ArrayBatch.getById(dc, arrayBatchId); |
2449 |
29 Jun 06 |
nicklas |
87 |
} |
2449 |
29 Jun 06 |
nicklas |
88 |
else if (cc.getPropertyFilter("arrayBatch.name") != null) |
2449 |
29 Jun 06 |
nicklas |
89 |
{ |
1812 |
24 Jan 06 |
nicklas |
90 |
currentArrayBatch = Base.getFirstMatching(dc, ArrayBatch.getQuery(), "name", cc.getPropertyFilter("arrayBatch.name")); |
1812 |
24 Jan 06 |
nicklas |
91 |
} |
2449 |
29 Jun 06 |
nicklas |
92 |
if (currentArrayBatch != null) |
2449 |
29 Jun 06 |
nicklas |
93 |
{ |
2474 |
31 Jul 06 |
nicklas |
94 |
maxIndex = (int)currentArrayBatch.getArraySlides().count(dc); |
2449 |
29 Jun 06 |
nicklas |
95 |
} |
1812 |
24 Jan 06 |
nicklas |
96 |
} |
1812 |
24 Jan 06 |
nicklas |
97 |
else |
1812 |
24 Jan 06 |
nicklas |
98 |
{ |
1812 |
24 Jan 06 |
nicklas |
99 |
slide = ArraySlide.getById(dc, itemId); |
6312 |
28 Aug 13 |
nicklas |
100 |
slide.checkPermission(Permission.WRITE); |
1812 |
24 Jan 06 |
nicklas |
101 |
cc.setObject("item", slide); |
1812 |
24 Jan 06 |
nicklas |
102 |
title = "Edit array slide -- " + HTML.encodeTags(slide.getName()); |
1812 |
24 Jan 06 |
nicklas |
103 |
try |
1812 |
24 Jan 06 |
nicklas |
104 |
{ |
1812 |
24 Jan 06 |
nicklas |
105 |
currentArrayBatch = slide.getArrayBatch(); |
1812 |
24 Jan 06 |
nicklas |
106 |
} |
1812 |
24 Jan 06 |
nicklas |
107 |
catch (PermissionDeniedException ex) |
1812 |
24 Jan 06 |
nicklas |
108 |
{ |
1812 |
24 Jan 06 |
nicklas |
109 |
readCurrentArrayBatch = false; |
1812 |
24 Jan 06 |
nicklas |
110 |
} |
1812 |
24 Jan 06 |
nicklas |
111 |
} |
6217 |
14 Dec 12 |
nicklas |
112 |
|
5498 |
17 Nov 10 |
nicklas |
113 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), slide); |
7604 |
25 Feb 19 |
nicklas |
114 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
1812 |
24 Jan 06 |
nicklas |
115 |
%> |
6312 |
28 Aug 13 |
nicklas |
116 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6312 |
28 Aug 13 |
nicklas |
117 |
<base:head scripts="tabcontrol-2.js,~slides.js" styles="tabcontrol.css"> |
5498 |
17 Nov 10 |
nicklas |
118 |
<ext:scripts context="<%=jspContext%>" /> |
5498 |
17 Nov 10 |
nicklas |
119 |
<ext:stylesheets context="<%=jspContext%>" /> |
1812 |
24 Jan 06 |
nicklas |
120 |
</base:head> |
6312 |
28 Aug 13 |
nicklas |
121 |
<base:body> |
5917 |
19 Dec 11 |
nicklas |
122 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6162 |
10 Oct 12 |
nicklas |
123 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="slide"> |
1812 |
24 Jan 06 |
nicklas |
124 |
<input type="hidden" name="cmd" value="UpdateItem"> |
1812 |
24 Jan 06 |
nicklas |
125 |
|
5917 |
19 Dec 11 |
nicklas |
126 |
<t:tabcontrol id="settings" |
5917 |
19 Dec 11 |
nicklas |
127 |
subclass="content dialogtabcontrol" |
6312 |
28 Aug 13 |
nicklas |
128 |
position="bottom" remember="<%=slide != null%>" |
5498 |
17 Nov 10 |
nicklas |
129 |
extensions="<%=invoker%>"> |
6312 |
28 Aug 13 |
nicklas |
130 |
<t:tab id="info" title="Array slide" helpid="arrayslide.edit"> |
5917 |
19 Dec 11 |
nicklas |
131 |
<table class="fullform input100"> |
1812 |
24 Jan 06 |
nicklas |
132 |
<tr> |
5917 |
19 Dec 11 |
nicklas |
133 |
<th>Name</th> |
6312 |
28 Aug 13 |
nicklas |
134 |
<td><input class="text required auto-init" data-auto-init="<%=slide == null ? "focus-select" : "focus" %>" |
6312 |
28 Aug 13 |
nicklas |
135 |
type="text" name="name" |
1812 |
24 Jan 06 |
nicklas |
136 |
value="<%=HTML.encodeTags(slide == null ? Values.getString(cc.getPropertyValue("name"), "New array slide") : slide.getName())%>" |
5917 |
19 Dec 11 |
nicklas |
137 |
maxlength="<%=ArraySlide.MAX_NAME_LENGTH%>"></td> |
5917 |
19 Dec 11 |
nicklas |
138 |
<td></td> |
1812 |
24 Jan 06 |
nicklas |
139 |
</tr> |
1812 |
24 Jan 06 |
nicklas |
140 |
<tr> |
5917 |
19 Dec 11 |
nicklas |
141 |
<th>Barcode</th> |
6217 |
14 Dec 12 |
nicklas |
142 |
<td><input class="text" type="text" name="barcode" |
1812 |
24 Jan 06 |
nicklas |
143 |
value="<%=HTML.encodeTags(slide == null ? Values.getString(cc.getPropertyValue("barcode"), "") : slide.getBarcode())%>" |
5917 |
19 Dec 11 |
nicklas |
144 |
maxlength="<%=ArraySlide.MAX_BARCODE_LENGTH%>"></td> |
5917 |
19 Dec 11 |
nicklas |
145 |
<td></td> |
1812 |
24 Jan 06 |
nicklas |
146 |
</tr> |
1812 |
24 Jan 06 |
nicklas |
147 |
<tr> |
5917 |
19 Dec 11 |
nicklas |
148 |
<th><label for="destroyed">Destroyed</label></th> |
5812 |
17 Oct 11 |
nicklas |
149 |
<td><input type="checkbox" name="destroyed" id="destroyed" value="1" |
1812 |
24 Jan 06 |
nicklas |
150 |
<%=(slide != null && slide.isDestroyed()) || (slide == null && Values.getBoolean(cc.getPropertyValue("destroyed"))) ? "checked" : ""%>> |
1812 |
24 Jan 06 |
nicklas |
151 |
</td> |
5917 |
19 Dec 11 |
nicklas |
152 |
<td></td> |
1812 |
24 Jan 06 |
nicklas |
153 |
</tr> |
1812 |
24 Jan 06 |
nicklas |
154 |
<tr> |
5917 |
19 Dec 11 |
nicklas |
155 |
<th>Array batch</th> |
1812 |
24 Jan 06 |
nicklas |
156 |
<td> |
1812 |
24 Jan 06 |
nicklas |
157 |
<% |
1812 |
24 Jan 06 |
nicklas |
158 |
if (slide != null) |
1812 |
24 Jan 06 |
nicklas |
159 |
{ |
1812 |
24 Jan 06 |
nicklas |
160 |
%> |
1812 |
24 Jan 06 |
nicklas |
161 |
<%=Base.getEncodedName(currentArrayBatch, !readCurrentArrayBatch)%> |
1812 |
24 Jan 06 |
nicklas |
162 |
<% |
1812 |
24 Jan 06 |
nicklas |
163 |
} |
1812 |
24 Jan 06 |
nicklas |
164 |
else |
1812 |
24 Jan 06 |
nicklas |
165 |
{ |
1812 |
24 Jan 06 |
nicklas |
166 |
%> |
2598 |
28 Aug 06 |
nicklas |
167 |
<base:select |
2598 |
28 Aug 06 |
nicklas |
168 |
id="arraybatch_id" |
2598 |
28 Aug 06 |
nicklas |
169 |
clazz="selectionlist required" |
2598 |
28 Aug 06 |
nicklas |
170 |
required="true" |
2598 |
28 Aug 06 |
nicklas |
171 |
current="<%=currentArrayBatch%>" |
2598 |
28 Aug 06 |
nicklas |
172 |
denied="<%=!readCurrentArrayBatch%>" |
2598 |
28 Aug 06 |
nicklas |
173 |
recent="<%=recentArrayBatches%>" |
2598 |
28 Aug 06 |
nicklas |
174 |
newitem="true" |
2598 |
28 Aug 06 |
nicklas |
175 |
/> |
1812 |
24 Jan 06 |
nicklas |
176 |
<% |
1812 |
24 Jan 06 |
nicklas |
177 |
} |
1812 |
24 Jan 06 |
nicklas |
178 |
%> |
1812 |
24 Jan 06 |
nicklas |
179 |
</td> |
5917 |
19 Dec 11 |
nicklas |
180 |
<td></td> |
1812 |
24 Jan 06 |
nicklas |
181 |
</tr> |
1812 |
24 Jan 06 |
nicklas |
182 |
<tr> |
5917 |
19 Dec 11 |
nicklas |
183 |
<th>Index</th> |
6312 |
28 Aug 13 |
nicklas |
184 |
<td><input class="text" type="text" name="batch_index" id="batch_index" |
6312 |
28 Aug 13 |
nicklas |
185 |
value="<%=slide == null ? Values.getInt(cc.getPropertyValue("batchIndex"), maxIndex + 1) : slide.getBatchIndex()%>" |
6312 |
28 Aug 13 |
nicklas |
186 |
maxlength="10" style="width: 15em;"></td> |
5917 |
19 Dec 11 |
nicklas |
187 |
<td></td> |
1812 |
24 Jan 06 |
nicklas |
188 |
</tr> |
5917 |
19 Dec 11 |
nicklas |
189 |
<tr class="dynamic"> |
5917 |
19 Dec 11 |
nicklas |
190 |
<th>Description</th> |
5917 |
19 Dec 11 |
nicklas |
191 |
<td> |
6217 |
14 Dec 12 |
nicklas |
192 |
<textarea class="text" rows="6" name="description" id="description" |
1812 |
24 Jan 06 |
nicklas |
193 |
><%=HTML.encodeTags(slide == null ? cc.getPropertyValue("description") : slide.getDescription())%></textarea> |
1812 |
24 Jan 06 |
nicklas |
194 |
</td> |
5917 |
19 Dec 11 |
nicklas |
195 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
196 |
<base:zoom textarea="description" title="Description" /> |
5917 |
19 Dec 11 |
nicklas |
197 |
</td> |
1812 |
24 Jan 06 |
nicklas |
198 |
</tr> |
1812 |
24 Jan 06 |
nicklas |
199 |
</table> |
1812 |
24 Jan 06 |
nicklas |
200 |
</t:tab> |
1812 |
24 Jan 06 |
nicklas |
201 |
|
6312 |
28 Aug 13 |
nicklas |
202 |
<t:tab id="annotations" title="Annotations & parameters" helpid="annotations.edit"> |
6254 |
22 Mar 13 |
nicklas |
203 |
<jsp:include page="../../common/annotations/annotate_frameset.jsp"> |
6254 |
22 Mar 13 |
nicklas |
204 |
<jsp:param name="item_type" value="<%=itemType.name()%>" /> |
6254 |
22 Mar 13 |
nicklas |
205 |
<jsp:param name="item_id" value="<%=itemId%>" /> |
6254 |
22 Mar 13 |
nicklas |
206 |
<jsp:param name="ID" value="<%=ID%>" /> |
6254 |
22 Mar 13 |
nicklas |
207 |
</jsp:include> |
6254 |
22 Mar 13 |
nicklas |
208 |
</t:tab> |
1812 |
24 Jan 06 |
nicklas |
209 |
</t:tabcontrol> |
5917 |
19 Dec 11 |
nicklas |
210 |
</form> |
1812 |
24 Jan 06 |
nicklas |
211 |
|
5917 |
19 Dec 11 |
nicklas |
212 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
213 |
<base:icon image="required.png" />= required information |
5917 |
19 Dec 11 |
nicklas |
214 |
</div> |
5917 |
19 Dec 11 |
nicklas |
215 |
|
5917 |
19 Dec 11 |
nicklas |
216 |
<base:buttongroup subclass="dialogbuttons"> |
6312 |
28 Aug 13 |
nicklas |
217 |
<base:button id="btnSave" title="Save" /> |
6312 |
28 Aug 13 |
nicklas |
218 |
<base:button id="close" title="Cancel" /> |
5917 |
19 Dec 11 |
nicklas |
219 |
</base:buttongroup> |
1812 |
24 Jan 06 |
nicklas |
220 |
</base:body> |
1812 |
24 Jan 06 |
nicklas |
221 |
</base:page> |
1812 |
24 Jan 06 |
nicklas |
222 |
<% |
1812 |
24 Jan 06 |
nicklas |
223 |
} |
1812 |
24 Jan 06 |
nicklas |
224 |
finally |
1812 |
24 Jan 06 |
nicklas |
225 |
{ |
1812 |
24 Jan 06 |
nicklas |
226 |
if (dc != null) dc.close(); |
1812 |
24 Jan 06 |
nicklas |
227 |
} |
1812 |
24 Jan 06 |
nicklas |
228 |
%> |