4543 |
22 Sep 08 |
nicklas |
1 |
<%-- $Id$ |
4543 |
22 Sep 08 |
nicklas |
2 |
------------------------------------------------------------------ |
4543 |
22 Sep 08 |
nicklas |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
4543 |
22 Sep 08 |
nicklas |
5 |
|
4543 |
22 Sep 08 |
nicklas |
6 |
This file is part of BASE - BioArray Software Environment. |
4543 |
22 Sep 08 |
nicklas |
7 |
Available at http://base.thep.lu.se/ |
4543 |
22 Sep 08 |
nicklas |
8 |
|
4543 |
22 Sep 08 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
4543 |
22 Sep 08 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
4543 |
22 Sep 08 |
nicklas |
11 |
as published by the Free Software Foundation; either version 3 |
4543 |
22 Sep 08 |
nicklas |
12 |
of the License, or (at your option) any later version. |
4543 |
22 Sep 08 |
nicklas |
13 |
|
4543 |
22 Sep 08 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
4543 |
22 Sep 08 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4543 |
22 Sep 08 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4543 |
22 Sep 08 |
nicklas |
17 |
GNU General Public License for more details. |
4543 |
22 Sep 08 |
nicklas |
18 |
|
4543 |
22 Sep 08 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4543 |
22 Sep 08 |
nicklas |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4543 |
22 Sep 08 |
nicklas |
21 |
------------------------------------------------------------------ |
4543 |
22 Sep 08 |
nicklas |
22 |
|
4543 |
22 Sep 08 |
nicklas |
23 |
|
4543 |
22 Sep 08 |
nicklas |
24 |
@author Nicklas |
4543 |
22 Sep 08 |
nicklas |
25 |
@version 2.0 |
4543 |
22 Sep 08 |
nicklas |
26 |
--%> |
5426 |
24 Sep 10 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
4543 |
22 Sep 08 |
nicklas |
28 |
import="net.sf.basedb.core.Application" |
4543 |
22 Sep 08 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
4543 |
22 Sep 08 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
4543 |
22 Sep 08 |
nicklas |
31 |
import="net.sf.basedb.core.Item" |
4543 |
22 Sep 08 |
nicklas |
32 |
import="net.sf.basedb.core.ItemContext" |
4543 |
22 Sep 08 |
nicklas |
33 |
import="net.sf.basedb.core.Permission" |
4543 |
22 Sep 08 |
nicklas |
34 |
import="net.sf.basedb.core.Quantity" |
4543 |
22 Sep 08 |
nicklas |
35 |
import="net.sf.basedb.core.ItemQuery" |
4543 |
22 Sep 08 |
nicklas |
36 |
import="net.sf.basedb.core.ItemResultList" |
4543 |
22 Sep 08 |
nicklas |
37 |
import="net.sf.basedb.core.query.Hql" |
4543 |
22 Sep 08 |
nicklas |
38 |
import="net.sf.basedb.core.query.Orders" |
4543 |
22 Sep 08 |
nicklas |
39 |
import="net.sf.basedb.core.PermissionDeniedException" |
4543 |
22 Sep 08 |
nicklas |
40 |
import="net.sf.basedb.clients.web.Base" |
4543 |
22 Sep 08 |
nicklas |
41 |
import="net.sf.basedb.clients.web.util.HTML" |
4543 |
22 Sep 08 |
nicklas |
42 |
import="net.sf.basedb.util.Values" |
5510 |
19 Nov 10 |
nicklas |
43 |
import="net.sf.basedb.core.plugin.GuiContext" |
5510 |
19 Nov 10 |
nicklas |
44 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5510 |
19 Nov 10 |
nicklas |
45 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5510 |
19 Nov 10 |
nicklas |
46 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
47 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5510 |
19 Nov 10 |
nicklas |
48 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
4543 |
22 Sep 08 |
nicklas |
49 |
%> |
4543 |
22 Sep 08 |
nicklas |
50 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
4543 |
22 Sep 08 |
nicklas |
51 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6149 |
25 Sep 12 |
nicklas |
52 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
4543 |
22 Sep 08 |
nicklas |
53 |
<% |
4543 |
22 Sep 08 |
nicklas |
54 |
final Item itemType = Item.QUANTITY; |
4543 |
22 Sep 08 |
nicklas |
55 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
4543 |
22 Sep 08 |
nicklas |
56 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
4543 |
22 Sep 08 |
nicklas |
57 |
final int itemId = cc.getId(); |
4543 |
22 Sep 08 |
nicklas |
58 |
final String ID = sc.getId(); |
4543 |
22 Sep 08 |
nicklas |
59 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
60 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
4543 |
22 Sep 08 |
nicklas |
61 |
try |
4543 |
22 Sep 08 |
nicklas |
62 |
{ |
4543 |
22 Sep 08 |
nicklas |
63 |
String title = null; |
4543 |
22 Sep 08 |
nicklas |
64 |
Quantity quantity = null; |
4543 |
22 Sep 08 |
nicklas |
65 |
|
4543 |
22 Sep 08 |
nicklas |
66 |
if (itemId == 0) |
4543 |
22 Sep 08 |
nicklas |
67 |
{ |
4543 |
22 Sep 08 |
nicklas |
68 |
title = "Create quantity"; |
4543 |
22 Sep 08 |
nicklas |
69 |
cc.removeObject("item"); |
4543 |
22 Sep 08 |
nicklas |
70 |
} |
4543 |
22 Sep 08 |
nicklas |
71 |
else |
4543 |
22 Sep 08 |
nicklas |
72 |
{ |
4543 |
22 Sep 08 |
nicklas |
73 |
quantity = Quantity.getById(dc, itemId); |
6305 |
09 Aug 13 |
nicklas |
74 |
quantity.checkPermission(Permission.WRITE); |
4543 |
22 Sep 08 |
nicklas |
75 |
cc.setObject("item", quantity); |
4543 |
22 Sep 08 |
nicklas |
76 |
title = "Edit quantity -- " + HTML.encodeTags(quantity.getName()); |
4543 |
22 Sep 08 |
nicklas |
77 |
} |
4543 |
22 Sep 08 |
nicklas |
78 |
|
5510 |
19 Nov 10 |
nicklas |
79 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), quantity); |
7604 |
25 Feb 19 |
nicklas |
80 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
4543 |
22 Sep 08 |
nicklas |
81 |
%> |
6305 |
09 Aug 13 |
nicklas |
82 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6305 |
09 Aug 13 |
nicklas |
83 |
<base:head scripts="tabcontrol-2.js,~quantities.js" styles="tabcontrol.css"> |
5510 |
19 Nov 10 |
nicklas |
84 |
<ext:scripts context="<%=jspContext%>" /> |
5510 |
19 Nov 10 |
nicklas |
85 |
<ext:stylesheets context="<%=jspContext%>" /> |
4543 |
22 Sep 08 |
nicklas |
86 |
</base:head> |
6305 |
09 Aug 13 |
nicklas |
87 |
<base:body> |
5922 |
11 Jan 12 |
nicklas |
88 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6162 |
10 Oct 12 |
nicklas |
89 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="quantity"> |
4543 |
22 Sep 08 |
nicklas |
90 |
<input type="hidden" name="cmd" value="UpdateItem"> |
4543 |
22 Sep 08 |
nicklas |
91 |
|
5922 |
11 Jan 12 |
nicklas |
92 |
<t:tabcontrol id="settings" |
5922 |
11 Jan 12 |
nicklas |
93 |
subclass="content dialogtabcontrol" |
5510 |
19 Nov 10 |
nicklas |
94 |
position="bottom" remember="<%=quantity != null%>" |
5510 |
19 Nov 10 |
nicklas |
95 |
extensions="<%=invoker%>"> |
6305 |
09 Aug 13 |
nicklas |
96 |
<t:tab id="info" title="Quantity" helpid="quantity.edit"> |
5922 |
11 Jan 12 |
nicklas |
97 |
<table class="fullform input100 smaller"> |
4543 |
22 Sep 08 |
nicklas |
98 |
<tr> |
5922 |
11 Jan 12 |
nicklas |
99 |
<th>Quantity</th> |
6305 |
09 Aug 13 |
nicklas |
100 |
<td><input class="text required auto-init" data-auto-init="<%=quantity == null ? "focus-select" : "focus" %>" |
6305 |
09 Aug 13 |
nicklas |
101 |
type="text" name="name" |
4543 |
22 Sep 08 |
nicklas |
102 |
value="<%=HTML.encodeTags(quantity == null ? Values.getString(cc.getPropertyValue("name"), "New quantity") : quantity.getName())%>" |
5922 |
11 Jan 12 |
nicklas |
103 |
maxlength="<%=Quantity.MAX_NAME_LENGTH%>"></td> |
5922 |
11 Jan 12 |
nicklas |
104 |
<td></td> |
4543 |
22 Sep 08 |
nicklas |
105 |
</tr> |
4543 |
22 Sep 08 |
nicklas |
106 |
<tr> |
5922 |
11 Jan 12 |
nicklas |
107 |
<th>Reference unit</th> |
6217 |
14 Dec 12 |
nicklas |
108 |
<td><input class="text required" type="text" name="referenceUnit" |
4543 |
22 Sep 08 |
nicklas |
109 |
value="<%=HTML.encodeTags(quantity == null ? Values.getString(cc.getPropertyValue("referenceUnit"), "") : quantity.getReferenceUnit())%>" |
5922 |
11 Jan 12 |
nicklas |
110 |
maxlength="<%=Quantity.MAX_REFERENCE_UNIT_LENGTH%>"></td> |
5922 |
11 Jan 12 |
nicklas |
111 |
<td></td> |
4543 |
22 Sep 08 |
nicklas |
112 |
</tr> |
5922 |
11 Jan 12 |
nicklas |
113 |
<tr class="dynamic"> |
5922 |
11 Jan 12 |
nicklas |
114 |
<th>Description</th> |
5922 |
11 Jan 12 |
nicklas |
115 |
<td> |
6217 |
14 Dec 12 |
nicklas |
116 |
<textarea class="text" rows="6" name="description" id="description" |
4543 |
22 Sep 08 |
nicklas |
117 |
><%=HTML.encodeTags(quantity == null ? cc.getPropertyValue("description") : quantity.getDescription())%></textarea> |
4543 |
22 Sep 08 |
nicklas |
118 |
</td> |
5922 |
11 Jan 12 |
nicklas |
119 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
120 |
<base:zoom textarea="description" title="Description" /> |
5922 |
11 Jan 12 |
nicklas |
121 |
</td> |
4543 |
22 Sep 08 |
nicklas |
122 |
</tr> |
4543 |
22 Sep 08 |
nicklas |
123 |
</table> |
4543 |
22 Sep 08 |
nicklas |
124 |
</t:tab> |
4543 |
22 Sep 08 |
nicklas |
125 |
</t:tabcontrol> |
5922 |
11 Jan 12 |
nicklas |
126 |
</form> |
5922 |
11 Jan 12 |
nicklas |
127 |
|
5922 |
11 Jan 12 |
nicklas |
128 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
129 |
<base:icon image="required.png" />= required information |
5922 |
11 Jan 12 |
nicklas |
130 |
</div> |
4543 |
22 Sep 08 |
nicklas |
131 |
|
5922 |
11 Jan 12 |
nicklas |
132 |
<base:buttongroup subclass="dialogbuttons"> |
6305 |
09 Aug 13 |
nicklas |
133 |
<base:button id="btnSave" title="Save" /> |
6305 |
09 Aug 13 |
nicklas |
134 |
<base:button id="close" title="Cancel" /> |
5922 |
11 Jan 12 |
nicklas |
135 |
</base:buttongroup> |
4543 |
22 Sep 08 |
nicklas |
136 |
</base:body> |
4543 |
22 Sep 08 |
nicklas |
137 |
</base:page> |
4543 |
22 Sep 08 |
nicklas |
138 |
<% |
4543 |
22 Sep 08 |
nicklas |
139 |
} |
4543 |
22 Sep 08 |
nicklas |
140 |
finally |
4543 |
22 Sep 08 |
nicklas |
141 |
{ |
4543 |
22 Sep 08 |
nicklas |
142 |
if (dc != null) dc.close(); |
4543 |
22 Sep 08 |
nicklas |
143 |
} |
4543 |
22 Sep 08 |
nicklas |
144 |
%> |