1976 |
13 Feb 06 |
nicklas |
1 |
<%-- $Id$ |
1976 |
13 Feb 06 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
1976 |
13 Feb 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/ |
1976 |
13 Feb 06 |
nicklas |
7 |
|
1976 |
13 Feb 06 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
1976 |
13 Feb 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 |
1976 |
13 Feb 06 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1976 |
13 Feb 06 |
nicklas |
12 |
|
1976 |
13 Feb 06 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
1976 |
13 Feb 06 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1976 |
13 Feb 06 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1976 |
13 Feb 06 |
nicklas |
16 |
GNU General Public License for more details. |
1976 |
13 Feb 06 |
nicklas |
17 |
|
1976 |
13 Feb 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/>. |
1976 |
13 Feb 06 |
nicklas |
20 |
------------------------------------------------------------------ |
1976 |
13 Feb 06 |
nicklas |
21 |
|
1976 |
13 Feb 06 |
nicklas |
22 |
|
1976 |
13 Feb 06 |
nicklas |
23 |
@author Nicklas |
1976 |
13 Feb 06 |
nicklas |
24 |
@version 2.0 |
1976 |
13 Feb 06 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
1976 |
13 Feb 06 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
1976 |
13 Feb 06 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
1976 |
13 Feb 06 |
nicklas |
29 |
import="net.sf.basedb.core.Item" |
1976 |
13 Feb 06 |
nicklas |
30 |
import="net.sf.basedb.core.ItemContext" |
1976 |
13 Feb 06 |
nicklas |
31 |
import="net.sf.basedb.core.SystemItems" |
1976 |
13 Feb 06 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
1976 |
13 Feb 06 |
nicklas |
33 |
import="net.sf.basedb.core.Include" |
1976 |
13 Feb 06 |
nicklas |
34 |
import="net.sf.basedb.core.ArrayDesign" |
1976 |
13 Feb 06 |
nicklas |
35 |
import="net.sf.basedb.core.ArrayDesignPlate" |
1976 |
13 Feb 06 |
nicklas |
36 |
import="net.sf.basedb.core.Plate" |
1976 |
13 Feb 06 |
nicklas |
37 |
import="net.sf.basedb.core.ItemQuery" |
1976 |
13 Feb 06 |
nicklas |
38 |
import="net.sf.basedb.core.ItemResultList" |
1976 |
13 Feb 06 |
nicklas |
39 |
import="net.sf.basedb.core.PermissionDeniedException" |
1976 |
13 Feb 06 |
nicklas |
40 |
import="net.sf.basedb.core.BaseException" |
1976 |
13 Feb 06 |
nicklas |
41 |
import="net.sf.basedb.core.query.Orders" |
1976 |
13 Feb 06 |
nicklas |
42 |
import="net.sf.basedb.core.query.Hql" |
1976 |
13 Feb 06 |
nicklas |
43 |
import="net.sf.basedb.clients.web.Base" |
1976 |
13 Feb 06 |
nicklas |
44 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
45 |
import="net.sf.basedb.util.Values" |
6312 |
28 Aug 13 |
nicklas |
46 |
import="net.sf.basedb.util.json.JsonUtil" |
6312 |
28 Aug 13 |
nicklas |
47 |
import="net.sf.basedb.util.json.JsonConverter" |
6312 |
28 Aug 13 |
nicklas |
48 |
import="org.json.simple.JSONObject" |
1976 |
13 Feb 06 |
nicklas |
49 |
import="java.util.List" |
1976 |
13 Feb 06 |
nicklas |
50 |
import="java.util.Set" |
1976 |
13 Feb 06 |
nicklas |
51 |
import="java.util.HashSet" |
1976 |
13 Feb 06 |
nicklas |
52 |
import="java.util.Date" |
1976 |
13 Feb 06 |
nicklas |
53 |
%> |
1976 |
13 Feb 06 |
nicklas |
54 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1976 |
13 Feb 06 |
nicklas |
55 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
1976 |
13 Feb 06 |
nicklas |
56 |
<% |
1976 |
13 Feb 06 |
nicklas |
57 |
final Item itemType = Item.ARRAYDESIGN; |
1976 |
13 Feb 06 |
nicklas |
58 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1976 |
13 Feb 06 |
nicklas |
59 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1976 |
13 Feb 06 |
nicklas |
60 |
final int itemId = cc.getId(); |
1976 |
13 Feb 06 |
nicklas |
61 |
final String ID = sc.getId(); |
1976 |
13 Feb 06 |
nicklas |
62 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
63 |
final DbControl dc = sc.newDbControl(":Manage plates"); |
1976 |
13 Feb 06 |
nicklas |
64 |
try |
1976 |
13 Feb 06 |
nicklas |
65 |
{ |
1976 |
13 Feb 06 |
nicklas |
66 |
ArrayDesign design = ArrayDesign.getById(dc, itemId); |
6312 |
28 Aug 13 |
nicklas |
67 |
design.checkPermission(Permission.WRITE); |
1976 |
13 Feb 06 |
nicklas |
68 |
cc.setObject("item", design); |
1976 |
13 Feb 06 |
nicklas |
69 |
String title = "Attach plate -- " + HTML.encodeTags(design.getName()); |
6312 |
28 Aug 13 |
nicklas |
70 |
|
6312 |
28 Aug 13 |
nicklas |
71 |
// Load current plates |
6312 |
28 Aug 13 |
nicklas |
72 |
JSONObject jsonPlates = new JSONObject(); |
6312 |
28 Aug 13 |
nicklas |
73 |
jsonPlates.put("itemType", "PLATE"); |
6312 |
28 Aug 13 |
nicklas |
74 |
ItemQuery<ArrayDesignPlate> platesQuery = design.getArrayDesignPlates(); |
6312 |
28 Aug 13 |
nicklas |
75 |
platesQuery.include(Include.MINE, Include.SHARED, Include.OTHERS, Include.IN_PROJECT); |
6312 |
28 Aug 13 |
nicklas |
76 |
platesQuery.order(Orders.asc(Hql.property("position"))); |
6312 |
28 Aug 13 |
nicklas |
77 |
jsonPlates.put("items", JsonUtil.toArray(platesQuery.iterate(dc), new JsonConverter<ArrayDesignPlate>() |
1976 |
13 Feb 06 |
nicklas |
78 |
{ |
6312 |
28 Aug 13 |
nicklas |
79 |
public Object convert(ArrayDesignPlate adp) |
6312 |
28 Aug 13 |
nicklas |
80 |
{ |
6312 |
28 Aug 13 |
nicklas |
81 |
Plate plate = adp.getPlate(); |
6312 |
28 Aug 13 |
nicklas |
82 |
JSONObject json = new JSONObject(); |
6312 |
28 Aug 13 |
nicklas |
83 |
json.put("id", plate.getId()); |
6312 |
28 Aug 13 |
nicklas |
84 |
json.put("name", plate.getName()); |
6312 |
28 Aug 13 |
nicklas |
85 |
return json; |
6312 |
28 Aug 13 |
nicklas |
86 |
} |
6312 |
28 Aug 13 |
nicklas |
87 |
})); |
1976 |
13 Feb 06 |
nicklas |
88 |
%> |
1976 |
13 Feb 06 |
nicklas |
89 |
<base:page type="popup" title="<%=title%>"> |
6312 |
28 Aug 13 |
nicklas |
90 |
<base:head scripts="linkitems-2.js,~manage_plates.js" /> |
6312 |
28 Aug 13 |
nicklas |
91 |
<base:body> |
5917 |
19 Dec 11 |
nicklas |
92 |
<h1><%=title%> <base:help helpid="arraydesign.edit.plates" /></h1> |
6162 |
10 Oct 12 |
nicklas |
93 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="design"> |
1976 |
13 Feb 06 |
nicklas |
94 |
<input type="hidden" name="cmd" value="UpdatePlates"> |
1976 |
13 Feb 06 |
nicklas |
95 |
|
5917 |
19 Dec 11 |
nicklas |
96 |
<div class="content bottomborder"> |
5917 |
19 Dec 11 |
nicklas |
97 |
<table class="fullform"> |
1976 |
13 Feb 06 |
nicklas |
98 |
<tr> |
5917 |
19 Dec 11 |
nicklas |
99 |
<th>Array design</th> |
1976 |
13 Feb 06 |
nicklas |
100 |
<td><%=HTML.encodeTags(design.getName())%></td> |
1976 |
13 Feb 06 |
nicklas |
101 |
</tr> |
5917 |
19 Dec 11 |
nicklas |
102 |
<tr class="dynamic"> |
5917 |
19 Dec 11 |
nicklas |
103 |
<th>Plates</th> |
1976 |
13 Feb 06 |
nicklas |
104 |
<td> |
5917 |
19 Dec 11 |
nicklas |
105 |
<div class="selectionlist"> |
1976 |
13 Feb 06 |
nicklas |
106 |
<table> |
5917 |
19 Dec 11 |
nicklas |
107 |
<tr style="vertical-align: top;"> |
1976 |
13 Feb 06 |
nicklas |
108 |
<td> |
5917 |
19 Dec 11 |
nicklas |
109 |
<base:buttongroup vertical="true"> |
5917 |
19 Dec 11 |
nicklas |
110 |
<base:button |
6312 |
28 Aug 13 |
nicklas |
111 |
id="moveUp" |
6312 |
28 Aug 13 |
nicklas |
112 |
data-down="0" |
5917 |
19 Dec 11 |
nicklas |
113 |
image="move_up.png" |
5917 |
19 Dec 11 |
nicklas |
114 |
tooltip="Move up" |
5917 |
19 Dec 11 |
nicklas |
115 |
subclass="square" |
5917 |
19 Dec 11 |
nicklas |
116 |
/> |
5917 |
19 Dec 11 |
nicklas |
117 |
<base:button |
6312 |
28 Aug 13 |
nicklas |
118 |
id="moveDown" |
6312 |
28 Aug 13 |
nicklas |
119 |
data-down="1" |
5917 |
19 Dec 11 |
nicklas |
120 |
image="move_down.png" |
5917 |
19 Dec 11 |
nicklas |
121 |
tooltip="Move down" |
5917 |
19 Dec 11 |
nicklas |
122 |
subclass="square" |
5917 |
19 Dec 11 |
nicklas |
123 |
/> |
5917 |
19 Dec 11 |
nicklas |
124 |
</base:buttongroup> |
1976 |
13 Feb 06 |
nicklas |
125 |
</td> |
1976 |
13 Feb 06 |
nicklas |
126 |
<td> |
6312 |
28 Aug 13 |
nicklas |
127 |
<select name="plates" id="plates" |
6312 |
28 Aug 13 |
nicklas |
128 |
class="auto-init" |
6312 |
28 Aug 13 |
nicklas |
129 |
data-auto-init="link-container" |
6312 |
28 Aug 13 |
nicklas |
130 |
data-initial-items="[<%=HTML.encodeTags(jsonPlates.toJSONString()) %>]" |
6312 |
28 Aug 13 |
nicklas |
131 |
size="15" multiple> |
1976 |
13 Feb 06 |
nicklas |
132 |
</select> |
1976 |
13 Feb 06 |
nicklas |
133 |
</td> |
1976 |
13 Feb 06 |
nicklas |
134 |
<td> |
5917 |
19 Dec 11 |
nicklas |
135 |
<base:buttongroup vertical="true"> |
5917 |
19 Dec 11 |
nicklas |
136 |
<base:button |
6312 |
28 Aug 13 |
nicklas |
137 |
subclass="leftaligned auto-init" |
6312 |
28 Aug 13 |
nicklas |
138 |
data-auto-init="add-link" |
6312 |
28 Aug 13 |
nicklas |
139 |
data-list-id="plates" |
6312 |
28 Aug 13 |
nicklas |
140 |
data-item-type="PLATE" |
5917 |
19 Dec 11 |
nicklas |
141 |
style="width: 12em;" |
5917 |
19 Dec 11 |
nicklas |
142 |
title="Add plates..." |
5917 |
19 Dec 11 |
nicklas |
143 |
tooltip="Add plates to be used" |
5917 |
19 Dec 11 |
nicklas |
144 |
/> |
5917 |
19 Dec 11 |
nicklas |
145 |
<base:button |
6312 |
28 Aug 13 |
nicklas |
146 |
subclass="leftaligned auto-init" |
6312 |
28 Aug 13 |
nicklas |
147 |
data-auto-init="remove-link" |
6312 |
28 Aug 13 |
nicklas |
148 |
data-list-id="plates" |
5917 |
19 Dec 11 |
nicklas |
149 |
style="width: 12em;" |
5917 |
19 Dec 11 |
nicklas |
150 |
title="Remove" |
5917 |
19 Dec 11 |
nicklas |
151 |
tooltip="Remove the selected plates" |
5917 |
19 Dec 11 |
nicklas |
152 |
/> |
5917 |
19 Dec 11 |
nicklas |
153 |
</base:buttongroup> |
1976 |
13 Feb 06 |
nicklas |
154 |
</td> |
1976 |
13 Feb 06 |
nicklas |
155 |
</tr> |
1976 |
13 Feb 06 |
nicklas |
156 |
</table> |
5917 |
19 Dec 11 |
nicklas |
157 |
</div> |
1976 |
13 Feb 06 |
nicklas |
158 |
</td> |
1976 |
13 Feb 06 |
nicklas |
159 |
</tr> |
1976 |
13 Feb 06 |
nicklas |
160 |
</table> |
5917 |
19 Dec 11 |
nicklas |
161 |
</div> |
5917 |
19 Dec 11 |
nicklas |
162 |
</form> |
1976 |
13 Feb 06 |
nicklas |
163 |
|
5917 |
19 Dec 11 |
nicklas |
164 |
<base:buttongroup subclass="dialogbuttons"> |
6312 |
28 Aug 13 |
nicklas |
165 |
<base:button id="btnSave" title="Save" /> |
6312 |
28 Aug 13 |
nicklas |
166 |
<base:button id="close" title="Cancel" /> |
5917 |
19 Dec 11 |
nicklas |
167 |
</base:buttongroup> |
1976 |
13 Feb 06 |
nicklas |
168 |
</base:body> |
1976 |
13 Feb 06 |
nicklas |
169 |
</base:page> |
1976 |
13 Feb 06 |
nicklas |
170 |
<% |
1976 |
13 Feb 06 |
nicklas |
171 |
} |
1976 |
13 Feb 06 |
nicklas |
172 |
finally |
1976 |
13 Feb 06 |
nicklas |
173 |
{ |
1976 |
13 Feb 06 |
nicklas |
174 |
if (dc != null) dc.close(); |
1976 |
13 Feb 06 |
nicklas |
175 |
} |
1976 |
13 Feb 06 |
nicklas |
176 |
%> |