2149 |
04 Apr 06 |
nicklas |
1 |
<%-- $Id$ |
2149 |
04 Apr 06 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
2149 |
04 Apr 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/ |
2149 |
04 Apr 06 |
nicklas |
7 |
|
2149 |
04 Apr 06 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
2149 |
04 Apr 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 |
2149 |
04 Apr 06 |
nicklas |
11 |
of the License, or (at your option) any later version. |
2149 |
04 Apr 06 |
nicklas |
12 |
|
2149 |
04 Apr 06 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
2149 |
04 Apr 06 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2149 |
04 Apr 06 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2149 |
04 Apr 06 |
nicklas |
16 |
GNU General Public License for more details. |
2149 |
04 Apr 06 |
nicklas |
17 |
|
2149 |
04 Apr 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/>. |
2149 |
04 Apr 06 |
nicklas |
20 |
------------------------------------------------------------------ |
2149 |
04 Apr 06 |
nicklas |
21 |
|
2149 |
04 Apr 06 |
nicklas |
22 |
@author Nicklas |
2149 |
04 Apr 06 |
nicklas |
23 |
@version 2.0 |
2149 |
04 Apr 06 |
nicklas |
24 |
--%> |
5426 |
24 Sep 10 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
2149 |
04 Apr 06 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
2149 |
04 Apr 06 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
2149 |
04 Apr 06 |
nicklas |
28 |
import="net.sf.basedb.core.Item" |
2149 |
04 Apr 06 |
nicklas |
29 |
import="net.sf.basedb.core.ItemContext" |
2149 |
04 Apr 06 |
nicklas |
30 |
import="net.sf.basedb.core.Permission" |
2149 |
04 Apr 06 |
nicklas |
31 |
import="net.sf.basedb.core.ReporterList" |
2149 |
04 Apr 06 |
nicklas |
32 |
import="net.sf.basedb.core.PermissionDeniedException" |
2149 |
04 Apr 06 |
nicklas |
33 |
import="net.sf.basedb.clients.web.Base" |
2149 |
04 Apr 06 |
nicklas |
34 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
35 |
import="net.sf.basedb.util.Values" |
5501 |
18 Nov 10 |
nicklas |
36 |
import="net.sf.basedb.core.plugin.GuiContext" |
5501 |
18 Nov 10 |
nicklas |
37 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5501 |
18 Nov 10 |
nicklas |
38 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5501 |
18 Nov 10 |
nicklas |
39 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
40 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5501 |
18 Nov 10 |
nicklas |
41 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
2149 |
04 Apr 06 |
nicklas |
42 |
import="java.util.List" |
2149 |
04 Apr 06 |
nicklas |
43 |
%> |
2149 |
04 Apr 06 |
nicklas |
44 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
2149 |
04 Apr 06 |
nicklas |
45 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6144 |
21 Sep 12 |
nicklas |
46 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
2149 |
04 Apr 06 |
nicklas |
47 |
<% |
2149 |
04 Apr 06 |
nicklas |
48 |
final Item itemType = Item.REPORTERLIST; |
2149 |
04 Apr 06 |
nicklas |
49 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
2149 |
04 Apr 06 |
nicklas |
50 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
2149 |
04 Apr 06 |
nicklas |
51 |
final int itemId = cc.getId(); |
2149 |
04 Apr 06 |
nicklas |
52 |
final String ID = sc.getId(); |
2149 |
04 Apr 06 |
nicklas |
53 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
54 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
2149 |
04 Apr 06 |
nicklas |
55 |
try |
2149 |
04 Apr 06 |
nicklas |
56 |
{ |
2149 |
04 Apr 06 |
nicklas |
57 |
String title = null; |
4305 |
21 May 08 |
nicklas |
58 |
String name = null; |
2149 |
04 Apr 06 |
nicklas |
59 |
ReporterList reporterList = null; |
2428 |
27 Jun 06 |
nicklas |
60 |
boolean addReporters = false; |
4301 |
16 May 08 |
nicklas |
61 |
boolean mergeReporterLists = false; |
4301 |
16 May 08 |
nicklas |
62 |
int numSelectedLists = cc.getSelected().size(); |
4306 |
21 May 08 |
nicklas |
63 |
String formId = request.getParameter("formId"); |
4305 |
21 May 08 |
nicklas |
64 |
String fromContext = Values.getString(request.getParameter("fromContext"), "REPORTER"); |
4305 |
21 May 08 |
nicklas |
65 |
String subContext = request.getParameter("subContext"); |
2149 |
04 Apr 06 |
nicklas |
66 |
|
2149 |
04 Apr 06 |
nicklas |
67 |
if (itemId == 0) |
2149 |
04 Apr 06 |
nicklas |
68 |
{ |
2149 |
04 Apr 06 |
nicklas |
69 |
title = "Create reporter list"; |
2149 |
04 Apr 06 |
nicklas |
70 |
cc.removeObject("item"); |
4301 |
16 May 08 |
nicklas |
71 |
addReporters = Values.getBoolean(request.getParameter("addReporters")); |
4301 |
16 May 08 |
nicklas |
72 |
mergeReporterLists = !addReporters && numSelectedLists > 0; |
4305 |
21 May 08 |
nicklas |
73 |
name = request.getParameter("name"); |
4305 |
21 May 08 |
nicklas |
74 |
if (name == null) name = Values.getString(cc.getPropertyValue("name"), "New reporter list"); |
2149 |
04 Apr 06 |
nicklas |
75 |
} |
2149 |
04 Apr 06 |
nicklas |
76 |
else |
2149 |
04 Apr 06 |
nicklas |
77 |
{ |
2149 |
04 Apr 06 |
nicklas |
78 |
reporterList = ReporterList.getById(dc, itemId); |
6314 |
02 Sep 13 |
nicklas |
79 |
reporterList.checkPermission(Permission.WRITE); |
4305 |
21 May 08 |
nicklas |
80 |
name = reporterList.getName(); |
2149 |
04 Apr 06 |
nicklas |
81 |
cc.setObject("item", reporterList); |
2149 |
04 Apr 06 |
nicklas |
82 |
title = "Edit reporter list -- " + HTML.encodeTags(reporterList.getName()); |
2149 |
04 Apr 06 |
nicklas |
83 |
} |
2149 |
04 Apr 06 |
nicklas |
84 |
|
5501 |
18 Nov 10 |
nicklas |
85 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), reporterList); |
7604 |
25 Feb 19 |
nicklas |
86 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
2149 |
04 Apr 06 |
nicklas |
87 |
%> |
6314 |
02 Sep 13 |
nicklas |
88 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6314 |
02 Sep 13 |
nicklas |
89 |
<base:head scripts="tabcontrol-2.js,~reporterlists.js" styles="tabcontrol.css"> |
5501 |
18 Nov 10 |
nicklas |
90 |
<ext:scripts context="<%=jspContext%>" /> |
5501 |
18 Nov 10 |
nicklas |
91 |
<ext:stylesheets context="<%=jspContext%>" /> |
2149 |
04 Apr 06 |
nicklas |
92 |
</base:head> |
6314 |
02 Sep 13 |
nicklas |
93 |
<base:body> |
5916 |
19 Dec 11 |
nicklas |
94 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6314 |
02 Sep 13 |
nicklas |
95 |
<div id="page-data" class="datacontainer" |
6314 |
02 Sep 13 |
nicklas |
96 |
data-num-selected-lists="<%=numSelectedLists %>" |
6314 |
02 Sep 13 |
nicklas |
97 |
data-add-reporters="<%=addReporters ? formId : "" %>" |
6314 |
02 Sep 13 |
nicklas |
98 |
></div> |
6162 |
10 Oct 12 |
nicklas |
99 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="reporterList"> |
2149 |
04 Apr 06 |
nicklas |
100 |
<input type="hidden" name="cmd" value="UpdateItem"> |
4305 |
21 May 08 |
nicklas |
101 |
<input type="hidden" name="fromContext" value="<%=fromContext%>"> |
4305 |
21 May 08 |
nicklas |
102 |
<% |
4305 |
21 May 08 |
nicklas |
103 |
if (subContext != null) |
4305 |
21 May 08 |
nicklas |
104 |
{ |
4305 |
21 May 08 |
nicklas |
105 |
%> |
4305 |
21 May 08 |
nicklas |
106 |
<input type="hidden" name="subContext" value="<%=subContext%>"> |
4305 |
21 May 08 |
nicklas |
107 |
<% |
4305 |
21 May 08 |
nicklas |
108 |
} |
4305 |
21 May 08 |
nicklas |
109 |
%> |
5916 |
19 Dec 11 |
nicklas |
110 |
<t:tabcontrol id="settings" |
5916 |
19 Dec 11 |
nicklas |
111 |
subclass="content dialogtabcontrol" |
5501 |
18 Nov 10 |
nicklas |
112 |
position="bottom" remember="<%=reporterList != null%>" |
5501 |
18 Nov 10 |
nicklas |
113 |
extensions="<%=invoker%>"> |
6314 |
02 Sep 13 |
nicklas |
114 |
<t:tab id="info" title="Reporter list" helpid="reporterlist.edit"> |
5916 |
19 Dec 11 |
nicklas |
115 |
<table class="fullform input100"> |
2149 |
04 Apr 06 |
nicklas |
116 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
117 |
<th>Name</th> |
6314 |
02 Sep 13 |
nicklas |
118 |
<td><input class="text required auto-init" data-auto-init="<%=reporterList == null ? "focus-select" : "focus" %>" |
6314 |
02 Sep 13 |
nicklas |
119 |
type="text" name="name" |
4305 |
21 May 08 |
nicklas |
120 |
value="<%=HTML.encodeTags(name)%>" |
5916 |
19 Dec 11 |
nicklas |
121 |
maxlength="<%=ReporterList.MAX_NAME_LENGTH%>"></td> |
5916 |
19 Dec 11 |
nicklas |
122 |
<td></td> |
2149 |
04 Apr 06 |
nicklas |
123 |
</tr> |
2149 |
04 Apr 06 |
nicklas |
124 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
125 |
<th>External ID</th> |
6217 |
14 Dec 12 |
nicklas |
126 |
<td><input class="text" type="text" name="external_id" |
2149 |
04 Apr 06 |
nicklas |
127 |
value="<%=HTML.encodeTags(reporterList == null ? Values.getString(cc.getPropertyValue("externalId")) : reporterList.getExternalId())%>" |
5916 |
19 Dec 11 |
nicklas |
128 |
maxlength="<%=ReporterList.MAX_EXTERNAL_ID_LENGTH%>"></td> |
5916 |
19 Dec 11 |
nicklas |
129 |
<td></td> |
2149 |
04 Apr 06 |
nicklas |
130 |
</tr> |
2428 |
27 Jun 06 |
nicklas |
131 |
<% |
2428 |
27 Jun 06 |
nicklas |
132 |
if (addReporters) |
2428 |
27 Jun 06 |
nicklas |
133 |
{ |
2428 |
27 Jun 06 |
nicklas |
134 |
%> |
5916 |
19 Dec 11 |
nicklas |
135 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
136 |
<th>Which reporters?</th> |
2428 |
27 Jun 06 |
nicklas |
137 |
<td> |
5812 |
17 Oct 11 |
nicklas |
138 |
<input type="radio" name="which" id="whichSelected" value="selected" |
5812 |
17 Oct 11 |
nicklas |
139 |
><label for="whichSelected" id="lblSelected">Selected items</label><br> |
5812 |
17 Oct 11 |
nicklas |
140 |
<input type="radio" name="which" id="whichPage" value="page" |
5812 |
17 Oct 11 |
nicklas |
141 |
><label for="whichPage">Current page</label><br> |
5812 |
17 Oct 11 |
nicklas |
142 |
<input type="radio" name="which" id="whichAll" value="all" checked |
5812 |
17 Oct 11 |
nicklas |
143 |
><label for="whichAll">All pages</label><br> |
2428 |
27 Jun 06 |
nicklas |
144 |
</td> |
5916 |
19 Dec 11 |
nicklas |
145 |
<td></td> |
2428 |
27 Jun 06 |
nicklas |
146 |
</tr> |
2428 |
27 Jun 06 |
nicklas |
147 |
<% |
2428 |
27 Jun 06 |
nicklas |
148 |
} |
4301 |
16 May 08 |
nicklas |
149 |
else if (mergeReporterLists) |
4301 |
16 May 08 |
nicklas |
150 |
{ |
4301 |
16 May 08 |
nicklas |
151 |
%> |
5916 |
19 Dec 11 |
nicklas |
152 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
153 |
<th>Add reporters?</th> |
4301 |
16 May 08 |
nicklas |
154 |
<td> |
5812 |
17 Oct 11 |
nicklas |
155 |
<input type="radio" name="create" id="createEmpty" value="" |
5812 |
17 Oct 11 |
nicklas |
156 |
><label for="createEmpty" |
5812 |
17 Oct 11 |
nicklas |
157 |
title="The new reporter list will be empty">No</label><br> |
5812 |
17 Oct 11 |
nicklas |
158 |
<input type="radio" name="create" id="createUnion" value="union" checked |
5812 |
17 Oct 11 |
nicklas |
159 |
><label for="createUnion" |
5812 |
17 Oct 11 |
nicklas |
160 |
title="The new reporter list contains all reporters from the selected lists" |
5812 |
17 Oct 11 |
nicklas |
161 |
>Union of selected lists</label> |
5812 |
17 Oct 11 |
nicklas |
162 |
<base:icon image="set_operations/union_small.png" /><br> |
5812 |
17 Oct 11 |
nicklas |
163 |
<input type="radio" name="create" id="createIntersection" value="intersection" |
5812 |
17 Oct 11 |
nicklas |
164 |
><label for="createIntersection" |
5812 |
17 Oct 11 |
nicklas |
165 |
title="The new reporter lists contains only reporters that are present in ALL selected lists" |
5812 |
17 Oct 11 |
nicklas |
166 |
>Intersection of selected lists</label> |
5812 |
17 Oct 11 |
nicklas |
167 |
<base:icon image="set_operations/intersection_small.png" /><br> |
5812 |
17 Oct 11 |
nicklas |
168 |
<input type="radio" name="create" id="createCount" value="count" |
5812 |
17 Oct 11 |
nicklas |
169 |
><label for="createCount" |
5812 |
17 Oct 11 |
nicklas |
170 |
title="The new reporter lists contains only reporters that are present in some of selected lists" |
5812 |
17 Oct 11 |
nicklas |
171 |
>Present in at least</label> |
6314 |
02 Sep 13 |
nicklas |
172 |
<input type="text" class="text" name="minCount" id="minCount" |
6314 |
02 Sep 13 |
nicklas |
173 |
style="width: 3em;" maxlength="2" value="1"> |
6314 |
02 Sep 13 |
nicklas |
174 |
of the selected lists (1-<%=numSelectedLists%>). |
4301 |
16 May 08 |
nicklas |
175 |
<br> |
4301 |
16 May 08 |
nicklas |
176 |
</td> |
5916 |
19 Dec 11 |
nicklas |
177 |
<td></td> |
4301 |
16 May 08 |
nicklas |
178 |
</tr> |
4301 |
16 May 08 |
nicklas |
179 |
<% |
4301 |
16 May 08 |
nicklas |
180 |
} |
2428 |
27 Jun 06 |
nicklas |
181 |
%> |
5916 |
19 Dec 11 |
nicklas |
182 |
<tr class="dynamic"> |
5916 |
19 Dec 11 |
nicklas |
183 |
<th>Description</th> |
6144 |
21 Sep 12 |
nicklas |
184 |
<td> |
6217 |
14 Dec 12 |
nicklas |
185 |
<textarea class="text" rows="6" name="description" id="description" |
2149 |
04 Apr 06 |
nicklas |
186 |
><%=HTML.encodeTags(reporterList == null ? cc.getPropertyValue("description") : reporterList.getDescription())%></textarea> |
2149 |
04 Apr 06 |
nicklas |
187 |
</td> |
5916 |
19 Dec 11 |
nicklas |
188 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
189 |
<base:zoom textarea="description" title="Description" /> |
5916 |
19 Dec 11 |
nicklas |
190 |
</td> |
2149 |
04 Apr 06 |
nicklas |
191 |
</tr> |
2149 |
04 Apr 06 |
nicklas |
192 |
</table> |
2149 |
04 Apr 06 |
nicklas |
193 |
</t:tab> |
2149 |
04 Apr 06 |
nicklas |
194 |
</t:tabcontrol> |
5916 |
19 Dec 11 |
nicklas |
195 |
</form> |
2149 |
04 Apr 06 |
nicklas |
196 |
|
5916 |
19 Dec 11 |
nicklas |
197 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
198 |
<base:icon image="required.png" />= required information |
5916 |
19 Dec 11 |
nicklas |
199 |
</div> |
5916 |
19 Dec 11 |
nicklas |
200 |
|
5916 |
19 Dec 11 |
nicklas |
201 |
<base:buttongroup subclass="dialogbuttons"> |
6314 |
02 Sep 13 |
nicklas |
202 |
<base:button id="btnSave" title="Save" /> |
6314 |
02 Sep 13 |
nicklas |
203 |
<base:button id="close" title="Cancel" /> |
5916 |
19 Dec 11 |
nicklas |
204 |
</base:buttongroup> |
2149 |
04 Apr 06 |
nicklas |
205 |
</base:body> |
2149 |
04 Apr 06 |
nicklas |
206 |
</base:page> |
2149 |
04 Apr 06 |
nicklas |
207 |
<% |
2149 |
04 Apr 06 |
nicklas |
208 |
} |
2149 |
04 Apr 06 |
nicklas |
209 |
finally |
2149 |
04 Apr 06 |
nicklas |
210 |
{ |
2149 |
04 Apr 06 |
nicklas |
211 |
if (dc != null) dc.close(); |
2149 |
04 Apr 06 |
nicklas |
212 |
} |
2149 |
04 Apr 06 |
nicklas |
213 |
%> |