702 |
01 Jun 05 |
nicklas |
1 |
<%-- $Id$ |
702 |
01 Jun 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
702 |
01 Jun 05 |
nicklas |
5 |
|
2304 |
22 May 06 |
jari |
6 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
7 |
Available at http://base.thep.lu.se/ |
702 |
01 Jun 05 |
nicklas |
8 |
|
702 |
01 Jun 05 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
702 |
01 Jun 05 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
11 |
as published by the Free Software Foundation; either version 3 |
702 |
01 Jun 05 |
nicklas |
12 |
of the License, or (at your option) any later version. |
702 |
01 Jun 05 |
nicklas |
13 |
|
702 |
01 Jun 05 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
702 |
01 Jun 05 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
702 |
01 Jun 05 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
702 |
01 Jun 05 |
nicklas |
17 |
GNU General Public License for more details. |
702 |
01 Jun 05 |
nicklas |
18 |
|
702 |
01 Jun 05 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
702 |
01 Jun 05 |
nicklas |
21 |
------------------------------------------------------------------ |
702 |
01 Jun 05 |
nicklas |
22 |
|
702 |
01 Jun 05 |
nicklas |
23 |
|
702 |
01 Jun 05 |
nicklas |
24 |
@author Nicklas |
702 |
01 Jun 05 |
nicklas |
25 |
@version 2.0 |
702 |
01 Jun 05 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
6334 |
16 Oct 13 |
olle |
28 |
import="net.sf.basedb.core.AnnotationType" |
702 |
01 Jun 05 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
702 |
01 Jun 05 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
702 |
01 Jun 05 |
nicklas |
31 |
import="net.sf.basedb.core.Item" |
1777 |
17 Jan 06 |
nicklas |
32 |
import="net.sf.basedb.core.ItemContext" |
702 |
01 Jun 05 |
nicklas |
33 |
import="net.sf.basedb.core.Permission" |
702 |
01 Jun 05 |
nicklas |
34 |
import="net.sf.basedb.core.Software" |
5630 |
13 May 11 |
nicklas |
35 |
import="net.sf.basedb.core.ItemSubtype" |
1777 |
17 Jan 06 |
nicklas |
36 |
import="net.sf.basedb.core.ItemQuery" |
5643 |
26 May 11 |
nicklas |
37 |
import="net.sf.basedb.core.Include" |
1777 |
17 Jan 06 |
nicklas |
38 |
import="net.sf.basedb.core.ItemResultList" |
702 |
01 Jun 05 |
nicklas |
39 |
import="net.sf.basedb.core.PermissionDeniedException" |
702 |
01 Jun 05 |
nicklas |
40 |
import="net.sf.basedb.core.query.Orders" |
1418 |
07 Oct 05 |
nicklas |
41 |
import="net.sf.basedb.core.query.Hql" |
702 |
01 Jun 05 |
nicklas |
42 |
import="net.sf.basedb.clients.web.Base" |
702 |
01 Jun 05 |
nicklas |
43 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
44 |
import="net.sf.basedb.util.Values" |
5506 |
19 Nov 10 |
nicklas |
45 |
import="net.sf.basedb.core.plugin.GuiContext" |
5506 |
19 Nov 10 |
nicklas |
46 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5506 |
19 Nov 10 |
nicklas |
47 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5506 |
19 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" |
5506 |
19 Nov 10 |
nicklas |
50 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
702 |
01 Jun 05 |
nicklas |
51 |
%> |
702 |
01 Jun 05 |
nicklas |
52 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
702 |
01 Jun 05 |
nicklas |
53 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6147 |
21 Sep 12 |
nicklas |
54 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
702 |
01 Jun 05 |
nicklas |
55 |
<% |
1777 |
17 Jan 06 |
nicklas |
56 |
final Item itemType = Item.SOFTWARE; |
1777 |
17 Jan 06 |
nicklas |
57 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1777 |
17 Jan 06 |
nicklas |
58 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1777 |
17 Jan 06 |
nicklas |
59 |
final int itemId = cc.getId(); |
702 |
01 Jun 05 |
nicklas |
60 |
final String ID = sc.getId(); |
702 |
01 Jun 05 |
nicklas |
61 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
62 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
702 |
01 Jun 05 |
nicklas |
63 |
try |
702 |
01 Jun 05 |
nicklas |
64 |
{ |
702 |
01 Jun 05 |
nicklas |
65 |
String title = null; |
702 |
01 Jun 05 |
nicklas |
66 |
Software software = null; |
5643 |
26 May 11 |
nicklas |
67 |
boolean readCurrentSubtype = true; |
5643 |
26 May 11 |
nicklas |
68 |
int currentSubtypeId = 0; |
1777 |
17 Jan 06 |
nicklas |
69 |
|
1777 |
17 Jan 06 |
nicklas |
70 |
if (itemId == 0) |
702 |
01 Jun 05 |
nicklas |
71 |
{ |
702 |
01 Jun 05 |
nicklas |
72 |
title = "Create software"; |
1777 |
17 Jan 06 |
nicklas |
73 |
cc.removeObject("item"); |
5643 |
26 May 11 |
nicklas |
74 |
currentSubtypeId = Values.getInt(request.getParameter("subtype_id")); |
5643 |
26 May 11 |
nicklas |
75 |
if (currentSubtypeId == 0) |
2442 |
28 Jun 06 |
nicklas |
76 |
{ |
5643 |
26 May 11 |
nicklas |
77 |
int recentSubtypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0)); |
5643 |
26 May 11 |
nicklas |
78 |
currentSubtypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), recentSubtypeId); |
2442 |
28 Jun 06 |
nicklas |
79 |
} |
702 |
01 Jun 05 |
nicklas |
80 |
} |
702 |
01 Jun 05 |
nicklas |
81 |
else |
702 |
01 Jun 05 |
nicklas |
82 |
{ |
1777 |
17 Jan 06 |
nicklas |
83 |
software = Software.getById(dc, itemId); |
5643 |
26 May 11 |
nicklas |
84 |
software.checkPermission(Permission.WRITE); |
1777 |
17 Jan 06 |
nicklas |
85 |
cc.setObject("item", software); |
702 |
01 Jun 05 |
nicklas |
86 |
title = "Edit software -- " + HTML.encodeTags(software.getName()); |
1777 |
17 Jan 06 |
nicklas |
87 |
try |
1777 |
17 Jan 06 |
nicklas |
88 |
{ |
5643 |
26 May 11 |
nicklas |
89 |
ItemSubtype subtype = software.getItemSubtype(); |
5643 |
26 May 11 |
nicklas |
90 |
if (subtype != null) currentSubtypeId = subtype.getId(); |
1777 |
17 Jan 06 |
nicklas |
91 |
} |
1777 |
17 Jan 06 |
nicklas |
92 |
catch (PermissionDeniedException ex) |
1777 |
17 Jan 06 |
nicklas |
93 |
{ |
5643 |
26 May 11 |
nicklas |
94 |
readCurrentSubtype = false; |
1777 |
17 Jan 06 |
nicklas |
95 |
} |
702 |
01 Jun 05 |
nicklas |
96 |
} |
702 |
01 Jun 05 |
nicklas |
97 |
|
702 |
01 Jun 05 |
nicklas |
98 |
// Query to retrieve file types |
5643 |
26 May 11 |
nicklas |
99 |
final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); |
5643 |
26 May 11 |
nicklas |
100 |
subtypesQuery.include(Include.ALL); |
5643 |
26 May 11 |
nicklas |
101 |
|
5506 |
19 Nov 10 |
nicklas |
102 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), software); |
7604 |
25 Feb 19 |
nicklas |
103 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
702 |
01 Jun 05 |
nicklas |
104 |
%> |
6222 |
14 Jan 13 |
nicklas |
105 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6222 |
14 Jan 13 |
nicklas |
106 |
<base:head scripts="tabcontrol-2.js,subtypes.js,~software.js" styles="tabcontrol.css"> |
5506 |
19 Nov 10 |
nicklas |
107 |
<ext:scripts context="<%=jspContext%>" /> |
5506 |
19 Nov 10 |
nicklas |
108 |
<ext:stylesheets context="<%=jspContext%>" /> |
702 |
01 Jun 05 |
nicklas |
109 |
</base:head> |
6222 |
14 Jan 13 |
nicklas |
110 |
<base:body> |
5921 |
10 Jan 12 |
nicklas |
111 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6162 |
10 Oct 12 |
nicklas |
112 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="software"> |
1777 |
17 Jan 06 |
nicklas |
113 |
<input type="hidden" name="cmd" value="UpdateItem"> |
1777 |
17 Jan 06 |
nicklas |
114 |
|
5921 |
10 Jan 12 |
nicklas |
115 |
<t:tabcontrol id="settings" |
5921 |
10 Jan 12 |
nicklas |
116 |
subclass="content dialogtabcontrol" |
5506 |
19 Nov 10 |
nicklas |
117 |
position="bottom" remember="<%=software != null%>" |
5506 |
19 Nov 10 |
nicklas |
118 |
extensions="<%=invoker%>"> |
6222 |
14 Jan 13 |
nicklas |
119 |
<t:tab id="info" title="Software" helpid="software.edit"> |
5921 |
10 Jan 12 |
nicklas |
120 |
<table class="fullform input100 smaller"> |
702 |
01 Jun 05 |
nicklas |
121 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
122 |
<th>Name</th> |
6222 |
14 Jan 13 |
nicklas |
123 |
<td><input class="text required auto-init" data-auto-init="<%=software == null ? "focus-select" : "focus" %>" type="text" name="name" |
1777 |
17 Jan 06 |
nicklas |
124 |
value="<%=HTML.encodeTags(software == null ? Values.getString(cc.getPropertyValue("name"), "New software") : software.getName())%>" |
5921 |
10 Jan 12 |
nicklas |
125 |
maxlength="<%=Software.MAX_NAME_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
126 |
<td></td> |
702 |
01 Jun 05 |
nicklas |
127 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
128 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
129 |
<th>Type</th> |
5921 |
10 Jan 12 |
nicklas |
130 |
<td> |
6222 |
14 Jan 13 |
nicklas |
131 |
<select name="subtype_id" id="subtype_id" |
6058 |
13 Jun 12 |
nicklas |
132 |
<%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%> |
6058 |
13 Jun 12 |
nicklas |
133 |
> |
702 |
01 Jun 05 |
nicklas |
134 |
<% |
5643 |
26 May 11 |
nicklas |
135 |
if (!readCurrentSubtype) |
702 |
01 Jun 05 |
nicklas |
136 |
{ |
702 |
01 Jun 05 |
nicklas |
137 |
%> |
702 |
01 Jun 05 |
nicklas |
138 |
<option value="-1">- denied - |
702 |
01 Jun 05 |
nicklas |
139 |
<% |
702 |
01 Jun 05 |
nicklas |
140 |
} |
702 |
01 Jun 05 |
nicklas |
141 |
else |
702 |
01 Jun 05 |
nicklas |
142 |
{ |
5643 |
26 May 11 |
nicklas |
143 |
%> |
5643 |
26 May 11 |
nicklas |
144 |
<option value="0">-none- |
5643 |
26 May 11 |
nicklas |
145 |
<% |
5643 |
26 May 11 |
nicklas |
146 |
for (ItemSubtype subtype : subtypesQuery.list(dc)) |
702 |
01 Jun 05 |
nicklas |
147 |
{ |
5643 |
26 May 11 |
nicklas |
148 |
int id = subtype.getId(); |
5643 |
26 May 11 |
nicklas |
149 |
if (id != currentSubtypeId && subtype.isRemoved()) continue; |
702 |
01 Jun 05 |
nicklas |
150 |
%> |
5643 |
26 May 11 |
nicklas |
151 |
<option value="<%=id == currentSubtypeId && software != null ? -id : id%>" |
5643 |
26 May 11 |
nicklas |
152 |
<%=id == currentSubtypeId ? "selected" : ""%> |
5643 |
26 May 11 |
nicklas |
153 |
title="<%=HTML.encodeTags(subtype.getDescription()) %>" |
5643 |
26 May 11 |
nicklas |
154 |
><%=HTML.encodeTags(subtype.getName())%> |
702 |
01 Jun 05 |
nicklas |
155 |
<% |
702 |
01 Jun 05 |
nicklas |
156 |
} |
702 |
01 Jun 05 |
nicklas |
157 |
} |
702 |
01 Jun 05 |
nicklas |
158 |
%> |
702 |
01 Jun 05 |
nicklas |
159 |
</select> |
702 |
01 Jun 05 |
nicklas |
160 |
</td> |
5921 |
10 Jan 12 |
nicklas |
161 |
<td></td> |
702 |
01 Jun 05 |
nicklas |
162 |
</tr> |
5643 |
26 May 11 |
nicklas |
163 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
164 |
<th>Version</th> |
6217 |
14 Dec 12 |
nicklas |
165 |
<td><input class="text" type="text" name="version" |
5643 |
26 May 11 |
nicklas |
166 |
value="<%=HTML.encodeTags(software == null ? cc.getPropertyValue("versionString") : software.getVersionString())%>" |
5921 |
10 Jan 12 |
nicklas |
167 |
maxlength="<%=Software.MAX_VERSIONSTRING_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
168 |
<td></td> |
5643 |
26 May 11 |
nicklas |
169 |
</tr> |
1777 |
17 Jan 06 |
nicklas |
170 |
|
5921 |
10 Jan 12 |
nicklas |
171 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
172 |
<th>Description</th> |
5921 |
10 Jan 12 |
nicklas |
173 |
<td> |
6217 |
14 Dec 12 |
nicklas |
174 |
<textarea class="text" rows="6" name="description" id="description" |
1777 |
17 Jan 06 |
nicklas |
175 |
><%=HTML.encodeTags(software == null ? cc.getPropertyValue("description") : software.getDescription())%></textarea> |
702 |
01 Jun 05 |
nicklas |
176 |
</td> |
5921 |
10 Jan 12 |
nicklas |
177 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
178 |
<base:zoom textarea="description" title="Description" /> |
5921 |
10 Jan 12 |
nicklas |
179 |
</td> |
702 |
01 Jun 05 |
nicklas |
180 |
</tr> |
5964 |
15 Feb 12 |
nicklas |
181 |
<% |
5964 |
15 Feb 12 |
nicklas |
182 |
if (sc.getActiveProjectId() != 0 && software == null && sc.getActiveProjectPermissions().contains(Permission.WRITE)) |
5964 |
15 Feb 12 |
nicklas |
183 |
{ |
5964 |
15 Feb 12 |
nicklas |
184 |
%> |
5964 |
15 Feb 12 |
nicklas |
185 |
<tr> |
5964 |
15 Feb 12 |
nicklas |
186 |
<th></th> |
6058 |
13 Jun 12 |
nicklas |
187 |
<td style="white-space: nowrap; overflow: hidden; padding-bottom: 2px;"> |
5964 |
15 Feb 12 |
nicklas |
188 |
<input type="checkbox" id="setAsProjectDefault" name="setAsProjectDefault" value="1" |
6058 |
13 Jun 12 |
nicklas |
189 |
checked><label for="setAsProjectDefault">Add as project default</label><br> |
6058 |
13 Jun 12 |
nicklas |
190 |
<input type="checkbox" id="replaceExistingDefault" name="replaceExistingDefault" value="1" |
6058 |
13 Jun 12 |
nicklas |
191 |
checked><label for="replaceExistingDefault">Replace existing default</label> |
6058 |
13 Jun 12 |
nicklas |
192 |
<span id="currentDefault" style="font-style: italic;"></span> |
5964 |
15 Feb 12 |
nicklas |
193 |
</td> |
5964 |
15 Feb 12 |
nicklas |
194 |
<td></td> |
5964 |
15 Feb 12 |
nicklas |
195 |
</tr> |
5964 |
15 Feb 12 |
nicklas |
196 |
<% |
5964 |
15 Feb 12 |
nicklas |
197 |
} |
5964 |
15 Feb 12 |
nicklas |
198 |
%> |
702 |
01 Jun 05 |
nicklas |
199 |
</table> |
702 |
01 Jun 05 |
nicklas |
200 |
</t:tab> |
6334 |
16 Oct 13 |
olle |
201 |
<t:tab id="annotations" title="Annotations" helpid="annotations.edit"> |
6334 |
16 Oct 13 |
olle |
202 |
<jsp:include page="../../common/annotations/annotate_frameset.jsp"> |
6334 |
16 Oct 13 |
olle |
203 |
<jsp:param name="item_type" value="<%=itemType.name()%>" /> |
6334 |
16 Oct 13 |
olle |
204 |
<jsp:param name="item_id" value="<%=itemId%>" /> |
6334 |
16 Oct 13 |
olle |
205 |
<jsp:param name="ID" value="<%=ID%>" /> |
6334 |
16 Oct 13 |
olle |
206 |
</jsp:include> |
6334 |
16 Oct 13 |
olle |
207 |
</t:tab> |
702 |
01 Jun 05 |
nicklas |
208 |
</t:tabcontrol> |
5921 |
10 Jan 12 |
nicklas |
209 |
</form> |
5921 |
10 Jan 12 |
nicklas |
210 |
|
5921 |
10 Jan 12 |
nicklas |
211 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
212 |
<base:icon image="required.png" />= required information |
5921 |
10 Jan 12 |
nicklas |
213 |
</div> |
702 |
01 Jun 05 |
nicklas |
214 |
|
5921 |
10 Jan 12 |
nicklas |
215 |
<base:buttongroup subclass="dialogbuttons"> |
6222 |
14 Jan 13 |
nicklas |
216 |
<base:button id="btnSave" title="Save" /> |
6222 |
14 Jan 13 |
nicklas |
217 |
<base:button id="close" title="Cancel" /> |
5921 |
10 Jan 12 |
nicklas |
218 |
</base:buttongroup> |
702 |
01 Jun 05 |
nicklas |
219 |
</base:body> |
702 |
01 Jun 05 |
nicklas |
220 |
</base:page> |
702 |
01 Jun 05 |
nicklas |
221 |
<% |
702 |
01 Jun 05 |
nicklas |
222 |
} |
702 |
01 Jun 05 |
nicklas |
223 |
finally |
702 |
01 Jun 05 |
nicklas |
224 |
{ |
702 |
01 Jun 05 |
nicklas |
225 |
if (dc != null) dc.close(); |
702 |
01 Jun 05 |
nicklas |
226 |
} |
702 |
01 Jun 05 |
nicklas |
227 |
%> |