4543 |
22 Sep 08 |
nicklas |
1 |
<%-- $Id$ |
4543 |
22 Sep 08 |
nicklas |
2 |
------------------------------------------------------------------ |
4889 |
06 Apr 09 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
4543 |
22 Sep 08 |
nicklas |
Copyright (C) 2007 Johan Enell |
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 |
@author Nicklas |
4543 |
22 Sep 08 |
nicklas |
24 |
@version 2.0 |
4543 |
22 Sep 08 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
4543 |
22 Sep 08 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
4543 |
22 Sep 08 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
4543 |
22 Sep 08 |
nicklas |
29 |
import="net.sf.basedb.core.Item" |
4543 |
22 Sep 08 |
nicklas |
30 |
import="net.sf.basedb.core.Type" |
4543 |
22 Sep 08 |
nicklas |
31 |
import="net.sf.basedb.core.Quantity" |
4543 |
22 Sep 08 |
nicklas |
32 |
import="net.sf.basedb.core.Quantity" |
4543 |
22 Sep 08 |
nicklas |
33 |
import="net.sf.basedb.core.Unit" |
4543 |
22 Sep 08 |
nicklas |
34 |
import="net.sf.basedb.core.Include" |
4543 |
22 Sep 08 |
nicklas |
35 |
import="net.sf.basedb.core.ItemQuery" |
4543 |
22 Sep 08 |
nicklas |
36 |
import="net.sf.basedb.core.ItemResultIterator" |
4543 |
22 Sep 08 |
nicklas |
37 |
import="net.sf.basedb.core.ItemResultList" |
4543 |
22 Sep 08 |
nicklas |
38 |
import="net.sf.basedb.core.ItemContext" |
4543 |
22 Sep 08 |
nicklas |
39 |
import="net.sf.basedb.core.Permission" |
4543 |
22 Sep 08 |
nicklas |
40 |
import="net.sf.basedb.core.PluginDefinition" |
4543 |
22 Sep 08 |
nicklas |
41 |
import="net.sf.basedb.core.query.Orders" |
4543 |
22 Sep 08 |
nicklas |
42 |
import="net.sf.basedb.core.query.Hql" |
4543 |
22 Sep 08 |
nicklas |
43 |
import="net.sf.basedb.core.query.Restrictions" |
4543 |
22 Sep 08 |
nicklas |
44 |
import="net.sf.basedb.core.query.Expressions" |
4543 |
22 Sep 08 |
nicklas |
45 |
import="net.sf.basedb.core.plugin.GuiContext" |
4543 |
22 Sep 08 |
nicklas |
46 |
import="net.sf.basedb.core.plugin.Plugin" |
4543 |
22 Sep 08 |
nicklas |
47 |
import="net.sf.basedb.util.Enumeration" |
4543 |
22 Sep 08 |
nicklas |
48 |
import="net.sf.basedb.clients.web.Base" |
4543 |
22 Sep 08 |
nicklas |
49 |
import="net.sf.basedb.clients.web.PermissionUtil" |
4543 |
22 Sep 08 |
nicklas |
50 |
import="net.sf.basedb.clients.web.ModeInfo" |
4543 |
22 Sep 08 |
nicklas |
51 |
import="net.sf.basedb.clients.web.util.HTML" |
4543 |
22 Sep 08 |
nicklas |
52 |
import="net.sf.basedb.util.Values" |
4886 |
03 Apr 09 |
nicklas |
53 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
4886 |
03 Apr 09 |
nicklas |
54 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
4886 |
03 Apr 09 |
nicklas |
55 |
import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
7604 |
25 Feb 19 |
nicklas |
56 |
import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" |
4886 |
03 Apr 09 |
nicklas |
57 |
import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
7604 |
25 Feb 19 |
nicklas |
58 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
6045 |
03 Apr 12 |
nicklas |
59 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
4886 |
03 Apr 09 |
nicklas |
60 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
4543 |
22 Sep 08 |
nicklas |
61 |
import="java.util.List" |
4543 |
22 Sep 08 |
nicklas |
62 |
import="java.util.Map" |
4543 |
22 Sep 08 |
nicklas |
63 |
%> |
4543 |
22 Sep 08 |
nicklas |
64 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
4543 |
22 Sep 08 |
nicklas |
65 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
4886 |
03 Apr 09 |
nicklas |
66 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
4543 |
22 Sep 08 |
nicklas |
67 |
<%! |
4543 |
22 Sep 08 |
nicklas |
68 |
private static final Item itemType = Item.QUANTITY; |
4543 |
22 Sep 08 |
nicklas |
69 |
private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
4543 |
22 Sep 08 |
nicklas |
70 |
%> |
4543 |
22 Sep 08 |
nicklas |
71 |
<% |
4543 |
22 Sep 08 |
nicklas |
72 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
4543 |
22 Sep 08 |
nicklas |
73 |
final String ID = sc.getId(); |
4543 |
22 Sep 08 |
nicklas |
74 |
final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
4543 |
22 Sep 08 |
nicklas |
75 |
final boolean writePermission = sc.hasPermission(Permission.WRITE, itemType); |
4543 |
22 Sep 08 |
nicklas |
76 |
final boolean deletePermission = sc.hasPermission(Permission.DELETE, itemType); |
4543 |
22 Sep 08 |
nicklas |
77 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
4543 |
22 Sep 08 |
nicklas |
78 |
|
4543 |
22 Sep 08 |
nicklas |
79 |
final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
4543 |
22 Sep 08 |
nicklas |
80 |
final String callback = request.getParameter("callback"); |
4543 |
22 Sep 08 |
nicklas |
81 |
final String title = mode.generateTitle("Quantity", "Quantities"); |
7954 |
12 May 21 |
nicklas |
82 |
final DbControl dc = sc.newDbControl(":List "+itemType); |
4543 |
22 Sep 08 |
nicklas |
83 |
ItemResultIterator<Quantity> quantities = null; |
4543 |
22 Sep 08 |
nicklas |
84 |
try |
4543 |
22 Sep 08 |
nicklas |
85 |
{ |
4543 |
22 Sep 08 |
nicklas |
86 |
// Query for units relatated to the current quantity |
4543 |
22 Sep 08 |
nicklas |
87 |
final ItemQuery<Unit> unitQuery = Unit.getQuery(); |
4543 |
22 Sep 08 |
nicklas |
88 |
unitQuery.include(cc.getInclude()); |
4543 |
22 Sep 08 |
nicklas |
89 |
unitQuery.restrict(Restrictions.eq(Hql.property("quantity"), Expressions.parameter("quantity"))); |
4547 |
26 Sep 08 |
nicklas |
90 |
unitQuery.order(Orders.desc(Hql.property("referenceFactor"))); |
4547 |
26 Sep 08 |
nicklas |
91 |
unitQuery.order(Orders.asc(Hql.property("displaySymbol"))); |
4543 |
22 Sep 08 |
nicklas |
92 |
final boolean createUnitPermission = sc.hasPermission(Permission.CREATE, Item.UNIT); |
4543 |
22 Sep 08 |
nicklas |
93 |
|
4543 |
22 Sep 08 |
nicklas |
94 |
Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
7914 |
23 Feb 21 |
nicklas |
95 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
4543 |
22 Sep 08 |
nicklas |
96 |
try |
4543 |
22 Sep 08 |
nicklas |
97 |
{ |
7914 |
23 Feb 21 |
nicklas |
98 |
final ItemQuery<Quantity> query = Base.getConfiguredQuery(dc, cc, jspContext, true, Quantity.getQuery(), mode); |
4543 |
22 Sep 08 |
nicklas |
99 |
quantities = query.iterate(dc); |
4543 |
22 Sep 08 |
nicklas |
100 |
} |
4543 |
22 Sep 08 |
nicklas |
101 |
catch (Throwable t) |
4543 |
22 Sep 08 |
nicklas |
102 |
{ |
4543 |
22 Sep 08 |
nicklas |
103 |
cc.setMessage(t.getMessage()); |
4543 |
22 Sep 08 |
nicklas |
104 |
} |
4543 |
22 Sep 08 |
nicklas |
105 |
int numListed = 0; |
7604 |
25 Feb 19 |
nicklas |
106 |
ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
107 |
ExtensionsInvoker<ListColumnAction<Quantity,?>> columnsInvoker = ListColumnUtil.useExtensions(jspContext); |
4543 |
22 Sep 08 |
nicklas |
108 |
%> |
6289 |
05 Jun 13 |
nicklas |
109 |
<base:page title="<%=title==null ? "Quantities" : title%>" type="<%=mode.getPageType()%>" id="list-page"> |
6289 |
05 Jun 13 |
nicklas |
110 |
<base:head scripts="table.js,~quantities.js" styles="table.css,toolbar.css"> |
4886 |
03 Apr 09 |
nicklas |
111 |
<ext:scripts context="<%=jspContext%>" /> |
4886 |
03 Apr 09 |
nicklas |
112 |
<ext:stylesheets context="<%=jspContext%>" /> |
4543 |
22 Sep 08 |
nicklas |
113 |
</base:head> |
4543 |
22 Sep 08 |
nicklas |
114 |
|
4543 |
22 Sep 08 |
nicklas |
115 |
<base:body> |
5954 |
13 Feb 12 |
nicklas |
116 |
<h1><%=title==null ? "Quantities" : title%></h1> |
5954 |
13 Feb 12 |
nicklas |
117 |
<div class="content"> |
4543 |
22 Sep 08 |
nicklas |
118 |
<tbl:table |
4543 |
22 Sep 08 |
nicklas |
119 |
id="quantities" |
4543 |
22 Sep 08 |
nicklas |
120 |
columns="<%=cc.getSetting("columns")%>" |
4543 |
22 Sep 08 |
nicklas |
121 |
sortby="<%=cc.getSortProperty()%>" |
4543 |
22 Sep 08 |
nicklas |
122 |
direction="<%=cc.getSortDirection()%>" |
4543 |
22 Sep 08 |
nicklas |
123 |
action="index.jsp" |
4543 |
22 Sep 08 |
nicklas |
124 |
sc="<%=sc%>" |
4543 |
22 Sep 08 |
nicklas |
125 |
item="<%=itemType%>" |
6706 |
02 Feb 15 |
nicklas |
126 |
filterrows="<%=cc.getFilterRows()%>" |
5954 |
13 Feb 12 |
nicklas |
127 |
subclass="fulltable" |
7982 |
14 Jun 21 |
nicklas |
128 |
stickyheaders="<%=cc.getSetting("columns.sticky", "name")%>" |
4543 |
22 Sep 08 |
nicklas |
129 |
> |
4543 |
22 Sep 08 |
nicklas |
130 |
<tbl:hidden |
4543 |
22 Sep 08 |
nicklas |
131 |
name="mode" |
4543 |
22 Sep 08 |
nicklas |
132 |
value="<%=mode.getName()%>" |
4543 |
22 Sep 08 |
nicklas |
133 |
/> |
4543 |
22 Sep 08 |
nicklas |
134 |
<tbl:hidden |
4543 |
22 Sep 08 |
nicklas |
135 |
name="callback" |
4543 |
22 Sep 08 |
nicklas |
136 |
value="<%=callback%>" |
4543 |
22 Sep 08 |
nicklas |
137 |
skip="<%=callback == null%>" |
4543 |
22 Sep 08 |
nicklas |
138 |
/> |
4543 |
22 Sep 08 |
nicklas |
139 |
<tbl:columndef |
4543 |
22 Sep 08 |
nicklas |
140 |
id="name" |
4543 |
22 Sep 08 |
nicklas |
141 |
property="name" |
4543 |
22 Sep 08 |
nicklas |
142 |
datatype="string" |
4543 |
22 Sep 08 |
nicklas |
143 |
title="Name" |
4543 |
22 Sep 08 |
nicklas |
144 |
sortable="true" |
4543 |
22 Sep 08 |
nicklas |
145 |
filterable="true" |
4543 |
22 Sep 08 |
nicklas |
146 |
exportable="true" |
4543 |
22 Sep 08 |
nicklas |
147 |
show="always" |
4543 |
22 Sep 08 |
nicklas |
148 |
/> |
4543 |
22 Sep 08 |
nicklas |
149 |
<tbl:columndef |
4543 |
22 Sep 08 |
nicklas |
150 |
id="id" |
4543 |
22 Sep 08 |
nicklas |
151 |
clazz="uniquecol" |
4543 |
22 Sep 08 |
nicklas |
152 |
property="id" |
4543 |
22 Sep 08 |
nicklas |
153 |
datatype="int" |
4543 |
22 Sep 08 |
nicklas |
154 |
title="ID" |
4543 |
22 Sep 08 |
nicklas |
155 |
sortable="true" |
4543 |
22 Sep 08 |
nicklas |
156 |
filterable="true" |
4543 |
22 Sep 08 |
nicklas |
157 |
exportable="true" |
4543 |
22 Sep 08 |
nicklas |
158 |
/> |
4543 |
22 Sep 08 |
nicklas |
159 |
<tbl:columndef |
4543 |
22 Sep 08 |
nicklas |
160 |
id="systemId" |
4543 |
22 Sep 08 |
nicklas |
161 |
clazz="uniquecol" |
4543 |
22 Sep 08 |
nicklas |
162 |
property="systemId" |
4543 |
22 Sep 08 |
nicklas |
163 |
datatype="string" |
4543 |
22 Sep 08 |
nicklas |
164 |
title="System ID" |
4543 |
22 Sep 08 |
nicklas |
165 |
sortable="true" |
4543 |
22 Sep 08 |
nicklas |
166 |
filterable="true" |
4543 |
22 Sep 08 |
nicklas |
167 |
exportable="true" |
4543 |
22 Sep 08 |
nicklas |
168 |
/> |
4543 |
22 Sep 08 |
nicklas |
169 |
<tbl:columndef |
4543 |
22 Sep 08 |
nicklas |
170 |
id="referenceUnit" |
4543 |
22 Sep 08 |
nicklas |
171 |
property="referenceUnit" |
4543 |
22 Sep 08 |
nicklas |
172 |
datatype="string" |
4543 |
22 Sep 08 |
nicklas |
173 |
title="Reference unit" |
4543 |
22 Sep 08 |
nicklas |
174 |
sortable="true" |
4543 |
22 Sep 08 |
nicklas |
175 |
filterable="true" |
4543 |
22 Sep 08 |
nicklas |
176 |
exportable="true" |
4543 |
22 Sep 08 |
nicklas |
177 |
/> |
4543 |
22 Sep 08 |
nicklas |
178 |
<tbl:columndef |
4543 |
22 Sep 08 |
nicklas |
179 |
id="units" |
4543 |
22 Sep 08 |
nicklas |
180 |
title="Units" |
4609 |
28 Oct 08 |
nicklas |
181 |
property="&units(displaySymbol)" |
4609 |
28 Oct 08 |
nicklas |
182 |
datatype="string" |
4609 |
28 Oct 08 |
nicklas |
183 |
filterable="true" |
4907 |
28 Apr 09 |
martin |
184 |
exportable="true" |
4543 |
22 Sep 08 |
nicklas |
185 |
/> |
4565 |
07 Oct 08 |
nicklas |
186 |
<tbl:columndef |
4565 |
07 Oct 08 |
nicklas |
187 |
id="formulas" |
4565 |
07 Oct 08 |
nicklas |
188 |
title="Conversion formulas" |
4565 |
07 Oct 08 |
nicklas |
189 |
/> |
4543 |
22 Sep 08 |
nicklas |
190 |
<tbl:columndef |
4543 |
22 Sep 08 |
nicklas |
191 |
id="description" |
4543 |
22 Sep 08 |
nicklas |
192 |
property="description" |
4543 |
22 Sep 08 |
nicklas |
193 |
datatype="string" |
4543 |
22 Sep 08 |
nicklas |
194 |
title="Description" |
4543 |
22 Sep 08 |
nicklas |
195 |
sortable="true" |
4543 |
22 Sep 08 |
nicklas |
196 |
filterable="true" |
4543 |
22 Sep 08 |
nicklas |
197 |
exportable="true" |
4543 |
22 Sep 08 |
nicklas |
198 |
/> |
6045 |
03 Apr 12 |
nicklas |
199 |
<tbl:columndef |
6045 |
03 Apr 12 |
nicklas |
200 |
id="xt-columns" |
6045 |
03 Apr 12 |
nicklas |
201 |
extensions="<%=columnsInvoker%>" |
6045 |
03 Apr 12 |
nicklas |
202 |
jspcontext="<%=jspContext%>" |
6045 |
03 Apr 12 |
nicklas |
203 |
/> |
6604 |
18 Nov 14 |
nicklas |
204 |
<div class="panelgroup bg-filled-50 bottomborder"> |
5954 |
13 Feb 12 |
nicklas |
205 |
<tbl:toolbar |
5954 |
13 Feb 12 |
nicklas |
206 |
subclass="bottomborder" |
5954 |
13 Feb 12 |
nicklas |
207 |
visible="<%=mode.hasToolbar()%>" |
5954 |
13 Feb 12 |
nicklas |
208 |
> |
5954 |
13 Feb 12 |
nicklas |
209 |
<tbl:button |
6289 |
05 Jun 13 |
nicklas |
210 |
id="btnNewItem" |
5954 |
13 Feb 12 |
nicklas |
211 |
disabled="<%=!createPermission%>" |
5954 |
13 Feb 12 |
nicklas |
212 |
image="new.png" |
5954 |
13 Feb 12 |
nicklas |
213 |
title="New…" |
5954 |
13 Feb 12 |
nicklas |
214 |
tooltip="<%=createPermission ? "Create new quantity" : "You do not have permission to create quantities"%>" |
5954 |
13 Feb 12 |
nicklas |
215 |
/> |
5954 |
13 Feb 12 |
nicklas |
216 |
<tbl:button |
6289 |
05 Jun 13 |
nicklas |
217 |
id="btnDeleteItems" |
5954 |
13 Feb 12 |
nicklas |
218 |
disabled="<%=!deletePermission%>" |
5954 |
13 Feb 12 |
nicklas |
219 |
image="delete.png" |
5954 |
13 Feb 12 |
nicklas |
220 |
title="Delete" |
5954 |
13 Feb 12 |
nicklas |
221 |
tooltip="<%=deletePermission ? "Delete the selected items" : "You do not have permission to delete quantities" %>" |
5954 |
13 Feb 12 |
nicklas |
222 |
/> |
5954 |
13 Feb 12 |
nicklas |
223 |
<tbl:button |
6289 |
05 Jun 13 |
nicklas |
224 |
id="btnRestoreItems" |
5954 |
13 Feb 12 |
nicklas |
225 |
disabled="<%=!writePermission%>" |
5954 |
13 Feb 12 |
nicklas |
226 |
image="restore.png" |
5954 |
13 Feb 12 |
nicklas |
227 |
title="Restore" |
5954 |
13 Feb 12 |
nicklas |
228 |
tooltip="<%=writePermission ? "Restore the selected (deleted) items" : "You do not have permission to edit quantities" %>" |
5954 |
13 Feb 12 |
nicklas |
229 |
/> |
5954 |
13 Feb 12 |
nicklas |
230 |
<tbl:button |
6289 |
05 Jun 13 |
nicklas |
231 |
id="btnColumns" |
5954 |
13 Feb 12 |
nicklas |
232 |
image="columns.png" |
5954 |
13 Feb 12 |
nicklas |
233 |
title="Columns…" |
5954 |
13 Feb 12 |
nicklas |
234 |
tooltip="Show, hide and re-order columns" |
5954 |
13 Feb 12 |
nicklas |
235 |
/> |
5954 |
13 Feb 12 |
nicklas |
236 |
<tbl:button |
6289 |
05 Jun 13 |
nicklas |
237 |
id="btnImport" |
6289 |
05 Jun 13 |
nicklas |
238 |
data-plugin-type="IMPORT" |
5954 |
13 Feb 12 |
nicklas |
239 |
image="import.png" |
5954 |
13 Feb 12 |
nicklas |
240 |
title="Import…" |
5954 |
13 Feb 12 |
nicklas |
241 |
tooltip="Import data" |
5954 |
13 Feb 12 |
nicklas |
242 |
visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
5954 |
13 Feb 12 |
nicklas |
243 |
/> |
5954 |
13 Feb 12 |
nicklas |
244 |
<tbl:button |
6289 |
05 Jun 13 |
nicklas |
245 |
id="btnExport" |
6289 |
05 Jun 13 |
nicklas |
246 |
data-plugin-type="EXPORT" |
5954 |
13 Feb 12 |
nicklas |
247 |
image="export.png" |
5954 |
13 Feb 12 |
nicklas |
248 |
title="Export…" |
5954 |
13 Feb 12 |
nicklas |
249 |
tooltip="Export data" |
5954 |
13 Feb 12 |
nicklas |
250 |
visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
5954 |
13 Feb 12 |
nicklas |
251 |
/> |
5954 |
13 Feb 12 |
nicklas |
252 |
<tbl:button |
6289 |
05 Jun 13 |
nicklas |
253 |
id="btnRunPlugin" |
6289 |
05 Jun 13 |
nicklas |
254 |
data-plugin-type="OTHER" |
5954 |
13 Feb 12 |
nicklas |
255 |
image="runplugin.png" |
5954 |
13 Feb 12 |
nicklas |
256 |
title="Run plugin…" |
5954 |
13 Feb 12 |
nicklas |
257 |
tooltip="Run a plugin" |
5954 |
13 Feb 12 |
nicklas |
258 |
visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
5954 |
13 Feb 12 |
nicklas |
259 |
/> |
5954 |
13 Feb 12 |
nicklas |
260 |
<ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
7604 |
25 Feb 19 |
nicklas |
261 |
wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/> |
5954 |
13 Feb 12 |
nicklas |
262 |
</tbl:toolbar> |
5954 |
13 Feb 12 |
nicklas |
263 |
<tbl:panel> |
6182 |
23 Oct 12 |
nicklas |
264 |
<tbl:presetselector /> |
5954 |
13 Feb 12 |
nicklas |
265 |
<tbl:navigator |
5954 |
13 Feb 12 |
nicklas |
266 |
page="<%=cc.getPage()%>" |
5954 |
13 Feb 12 |
nicklas |
267 |
rowsperpage="<%=cc.getRowsPerPage()%>" |
5954 |
13 Feb 12 |
nicklas |
268 |
totalrows="<%=quantities == null ? 0 : quantities.getTotalCount()%>" |
5954 |
13 Feb 12 |
nicklas |
269 |
visible="<%=mode.hasNavigator()%>" |
5954 |
13 Feb 12 |
nicklas |
270 |
/> |
5954 |
13 Feb 12 |
nicklas |
271 |
</tbl:panel> |
5954 |
13 Feb 12 |
nicklas |
272 |
</div> |
4543 |
22 Sep 08 |
nicklas |
273 |
<tbl:data> |
5948 |
08 Feb 12 |
nicklas |
274 |
<tbl:headers> |
5948 |
08 Feb 12 |
nicklas |
275 |
<tbl:headerrow> |
7943 |
04 May 21 |
nicklas |
276 |
<tbl:header clazz="row-index bg-filled-100" /> |
5948 |
08 Feb 12 |
nicklas |
277 |
<tbl:columnheaders /> |
5948 |
08 Feb 12 |
nicklas |
278 |
</tbl:headerrow> |
6706 |
02 Feb 15 |
nicklas |
279 |
<% |
6706 |
02 Feb 15 |
nicklas |
280 |
int numFilters = cc.getNumPropertyFilters(); |
6706 |
02 Feb 15 |
nicklas |
281 |
int numRows = cc.getFilterRows(); |
6706 |
02 Feb 15 |
nicklas |
282 |
for (int filterNo = 0; filterNo < numRows; filterNo++) |
6706 |
02 Feb 15 |
nicklas |
283 |
{ |
6706 |
02 Feb 15 |
nicklas |
284 |
boolean lastRow = filterNo == numRows-1; |
6706 |
02 Feb 15 |
nicklas |
285 |
%> |
6706 |
02 Feb 15 |
nicklas |
286 |
<tbl:headerrow> |
7943 |
04 May 21 |
nicklas |
287 |
<tbl:header subclass="row-index bg-filled-100"> |
7943 |
04 May 21 |
nicklas |
288 |
<div class="index-<%=mode.getName()%>"> |
7943 |
04 May 21 |
nicklas |
289 |
<div class="index"></div> |
7943 |
04 May 21 |
nicklas |
290 |
<div class="check"> |
7943 |
04 May 21 |
nicklas |
291 |
<base:icon |
7943 |
04 May 21 |
nicklas |
292 |
subclass="link table-check" |
7943 |
04 May 21 |
nicklas |
293 |
image="check_uncheck.png" |
7943 |
04 May 21 |
nicklas |
294 |
tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" |
7943 |
04 May 21 |
nicklas |
295 |
visible="<%=lastRow && mode.hasCheck()%>" |
7943 |
04 May 21 |
nicklas |
296 |
/> |
7943 |
04 May 21 |
nicklas |
297 |
</div> |
7943 |
04 May 21 |
nicklas |
298 |
<div class="icons"> |
7943 |
04 May 21 |
nicklas |
299 |
<base:icon |
7943 |
04 May 21 |
nicklas |
300 |
subclass="link table-filter-row-action" |
7943 |
04 May 21 |
nicklas |
301 |
image="add.png" |
7943 |
04 May 21 |
nicklas |
302 |
tooltip="Add extra filter row" |
7943 |
04 May 21 |
nicklas |
303 |
visible="<%=lastRow%>" |
7943 |
04 May 21 |
nicklas |
304 |
/><base:icon |
7943 |
04 May 21 |
nicklas |
305 |
subclass="link table-filter-row-action" |
7943 |
04 May 21 |
nicklas |
306 |
image="remove.png" |
7943 |
04 May 21 |
nicklas |
307 |
tooltip="Remove this filter row" |
7943 |
04 May 21 |
nicklas |
308 |
visible="<%=numRows > 1 || numFilters > 0 %>" |
7943 |
04 May 21 |
nicklas |
309 |
data-remove-row="<%=filterNo%>" |
7943 |
04 May 21 |
nicklas |
310 |
/> |
7943 |
04 May 21 |
nicklas |
311 |
</div> |
7943 |
04 May 21 |
nicklas |
312 |
</div> |
6706 |
02 Feb 15 |
nicklas |
313 |
</tbl:header> |
6706 |
02 Feb 15 |
nicklas |
314 |
<tbl:propertyfilter row="<%=filterNo%>" /> |
6706 |
02 Feb 15 |
nicklas |
315 |
</tbl:headerrow> |
6706 |
02 Feb 15 |
nicklas |
316 |
<% |
6706 |
02 Feb 15 |
nicklas |
317 |
} |
6706 |
02 Feb 15 |
nicklas |
318 |
%> |
7913 |
22 Feb 21 |
nicklas |
319 |
<tbl:columnsubtitles /> |
5948 |
08 Feb 12 |
nicklas |
320 |
</tbl:headers> |
5948 |
08 Feb 12 |
nicklas |
321 |
<tbl:rows> |
4543 |
22 Sep 08 |
nicklas |
322 |
<% |
5954 |
13 Feb 12 |
nicklas |
323 |
if (cc.getMessage() != null) |
5954 |
13 Feb 12 |
nicklas |
324 |
{ |
5954 |
13 Feb 12 |
nicklas |
325 |
%> |
6604 |
18 Nov 14 |
nicklas |
326 |
<tbl:panel subclass="bg-filled-50"> |
5954 |
13 Feb 12 |
nicklas |
327 |
<div class="messagecontainer error"><%=cc.getMessage()%></div> |
5954 |
13 Feb 12 |
nicklas |
328 |
</tbl:panel> |
5954 |
13 Feb 12 |
nicklas |
329 |
<% |
5954 |
13 Feb 12 |
nicklas |
330 |
cc.setMessage(null); |
5954 |
13 Feb 12 |
nicklas |
331 |
} |
4543 |
22 Sep 08 |
nicklas |
332 |
int index = cc.getPage()*cc.getRowsPerPage(); |
4543 |
22 Sep 08 |
nicklas |
333 |
int selectedItemId = cc.getId(); |
4543 |
22 Sep 08 |
nicklas |
334 |
if (quantities != null) |
4543 |
22 Sep 08 |
nicklas |
335 |
{ |
4543 |
22 Sep 08 |
nicklas |
336 |
while (quantities.hasNext()) |
4543 |
22 Sep 08 |
nicklas |
337 |
{ |
4543 |
22 Sep 08 |
nicklas |
338 |
Quantity item = quantities.next(); |
4543 |
22 Sep 08 |
nicklas |
339 |
int itemId = item.getId(); |
4543 |
22 Sep 08 |
nicklas |
340 |
boolean usePermission = item.hasPermission(Permission.USE); |
4543 |
22 Sep 08 |
nicklas |
341 |
String name = HTML.encodeTags(item.getName()); |
4543 |
22 Sep 08 |
nicklas |
342 |
String tooltip = mode.isSelectionMode() ? |
4543 |
22 Sep 08 |
nicklas |
343 |
"Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
6221 |
10 Jan 13 |
nicklas |
344 |
|
4543 |
22 Sep 08 |
nicklas |
345 |
index++; |
4543 |
22 Sep 08 |
nicklas |
346 |
numListed++; |
4543 |
22 Sep 08 |
nicklas |
347 |
%> |
4543 |
22 Sep 08 |
nicklas |
348 |
<tbl:row> |
7943 |
04 May 21 |
nicklas |
349 |
<tbl:header clazz="row-index bg-filled-100"> |
7943 |
04 May 21 |
nicklas |
350 |
<div class="index-<%=mode.getName()%>"> |
7943 |
04 May 21 |
nicklas |
351 |
<div class="index <%=index>999?"index-smaller":""%>"><%=index%></div> |
7943 |
04 May 21 |
nicklas |
352 |
<div class="check"> |
7943 |
04 May 21 |
nicklas |
353 |
<base:input |
7943 |
04 May 21 |
nicklas |
354 |
type="checkbox" |
7943 |
04 May 21 |
nicklas |
355 |
name="<%=itemId%>" |
7943 |
04 May 21 |
nicklas |
356 |
value="<%=itemId%>" |
7943 |
04 May 21 |
nicklas |
357 |
title="<%=name%>" |
7943 |
04 May 21 |
nicklas |
358 |
checked="<%=cc.getSelected().contains(itemId)%>" |
7943 |
04 May 21 |
nicklas |
359 |
visible="<%=mode.hasCheck()%>" |
7943 |
04 May 21 |
nicklas |
360 |
/> |
7943 |
04 May 21 |
nicklas |
361 |
<base:input |
7943 |
04 May 21 |
nicklas |
362 |
type="radio" |
7943 |
04 May 21 |
nicklas |
363 |
name="item_id" |
7943 |
04 May 21 |
nicklas |
364 |
value="<%=itemId%>" |
7943 |
04 May 21 |
nicklas |
365 |
title="<%=name%>" |
7943 |
04 May 21 |
nicklas |
366 |
checked="<%=selectedItemId == itemId%>" |
7943 |
04 May 21 |
nicklas |
367 |
visible="<%=mode.hasRadio()%>" |
7943 |
04 May 21 |
nicklas |
368 |
/> |
7943 |
04 May 21 |
nicklas |
369 |
</div> |
7943 |
04 May 21 |
nicklas |
370 |
<div class="icons"> |
7943 |
04 May 21 |
nicklas |
371 |
<base:icon |
7943 |
04 May 21 |
nicklas |
372 |
image="deleted.png" |
7943 |
04 May 21 |
nicklas |
373 |
id="<%="delete."+itemId %>" |
7943 |
04 May 21 |
nicklas |
374 |
subclass="<%=deletePermission ? "table-delete-item" : "disabled" %>" |
7943 |
04 May 21 |
nicklas |
375 |
data-item-id="<%=itemId%>" |
7943 |
04 May 21 |
nicklas |
376 |
tooltip="This item has been scheduled for deletion" |
7943 |
04 May 21 |
nicklas |
377 |
visible="<%=item.isRemoved()%>" |
7943 |
04 May 21 |
nicklas |
378 |
/><base:icon |
7943 |
04 May 21 |
nicklas |
379 |
image="systemitem.png" |
7943 |
04 May 21 |
nicklas |
380 |
tooltip="This item is a system item" |
7943 |
04 May 21 |
nicklas |
381 |
visible="<%=item.isSystemItem()%>" |
7943 |
04 May 21 |
nicklas |
382 |
/> |
7943 |
04 May 21 |
nicklas |
383 |
</div> |
7943 |
04 May 21 |
nicklas |
384 |
</div> |
7943 |
04 May 21 |
nicklas |
385 |
</tbl:header> |
6289 |
05 Jun 13 |
nicklas |
386 |
<tbl:cell column="name"><div |
6289 |
05 Jun 13 |
nicklas |
387 |
class="link table-item" |
6289 |
05 Jun 13 |
nicklas |
388 |
data-item-id="<%=itemId%>" |
6289 |
05 Jun 13 |
nicklas |
389 |
data-no-edit="<%=writePermission ? 0 : 1 %>" |
6289 |
05 Jun 13 |
nicklas |
390 |
tabindex="0" |
4543 |
22 Sep 08 |
nicklas |
391 |
title="<%=tooltip%>"><%=name%></div></tbl:cell> |
4543 |
22 Sep 08 |
nicklas |
392 |
<tbl:cell column="id"><%=item.getId()%></tbl:cell> |
4543 |
22 Sep 08 |
nicklas |
393 |
<tbl:cell column="systemId"><%=HTML.encodeTags(item.getSystemId())%></tbl:cell> |
6149 |
25 Sep 12 |
nicklas |
394 |
<tbl:cell column="referenceUnit"><%=HTML.encodeTags(item.getReferenceUnit())%></tbl:cell> |
4543 |
22 Sep 08 |
nicklas |
395 |
<tbl:cell column="units"> |
4543 |
22 Sep 08 |
nicklas |
396 |
<% |
4543 |
22 Sep 08 |
nicklas |
397 |
unitQuery.setParameter("quantity", itemId, Type.INT); |
4543 |
22 Sep 08 |
nicklas |
398 |
try |
4543 |
22 Sep 08 |
nicklas |
399 |
{ |
4543 |
22 Sep 08 |
nicklas |
400 |
String separator = ""; |
4543 |
22 Sep 08 |
nicklas |
401 |
for (Unit u : unitQuery.list(dc)) |
4543 |
22 Sep 08 |
nicklas |
402 |
{ |
4543 |
22 Sep 08 |
nicklas |
403 |
out.write(separator); |
4543 |
22 Sep 08 |
nicklas |
404 |
if (mode.hasPropertyLink()) |
4543 |
22 Sep 08 |
nicklas |
405 |
{ |
4545 |
25 Sep 08 |
nicklas |
406 |
out.write(Base.getLink(ID, u.getDisplaySymbol(), Item.UNIT, u.getId(), |
4545 |
25 Sep 08 |
nicklas |
407 |
mode.hasEditLink(), u.getName() + "; click to view")); |
4543 |
22 Sep 08 |
nicklas |
408 |
} |
4543 |
22 Sep 08 |
nicklas |
409 |
else |
4543 |
22 Sep 08 |
nicklas |
410 |
{ |
4543 |
22 Sep 08 |
nicklas |
411 |
out.write(HTML.encodeTags(u.getName())); |
4543 |
22 Sep 08 |
nicklas |
412 |
} |
4543 |
22 Sep 08 |
nicklas |
413 |
separator = ", "; |
4543 |
22 Sep 08 |
nicklas |
414 |
} |
4543 |
22 Sep 08 |
nicklas |
415 |
} |
4543 |
22 Sep 08 |
nicklas |
416 |
catch (Throwable t) |
4543 |
22 Sep 08 |
nicklas |
417 |
{ |
4543 |
22 Sep 08 |
nicklas |
418 |
%> |
4543 |
22 Sep 08 |
nicklas |
419 |
<div class="error"><%=t.getMessage()%></div> |
4543 |
22 Sep 08 |
nicklas |
420 |
<% |
4543 |
22 Sep 08 |
nicklas |
421 |
} |
4543 |
22 Sep 08 |
nicklas |
422 |
%> |
4543 |
22 Sep 08 |
nicklas |
423 |
<base:icon |
6289 |
05 Jun 13 |
nicklas |
424 |
id="<%="new-unit."+itemId%>" |
6289 |
05 Jun 13 |
nicklas |
425 |
subclass="auto-init" |
6289 |
05 Jun 13 |
nicklas |
426 |
data-auto-init="new-unit" |
6289 |
05 Jun 13 |
nicklas |
427 |
data-item-id="<%=itemId%>" |
4543 |
22 Sep 08 |
nicklas |
428 |
image="add.png" |
4543 |
22 Sep 08 |
nicklas |
429 |
tooltip="Create new unit" |
4543 |
22 Sep 08 |
nicklas |
430 |
visible="<%=mode.hasEditLink() && createUnitPermission && usePermission %>" |
4543 |
22 Sep 08 |
nicklas |
431 |
/> |
4543 |
22 Sep 08 |
nicklas |
432 |
</tbl:cell> |
4565 |
07 Oct 08 |
nicklas |
433 |
<tbl:cell column="formulas"> |
4565 |
07 Oct 08 |
nicklas |
434 |
<% |
4565 |
07 Oct 08 |
nicklas |
435 |
unitQuery.setParameter("quantity", itemId, Type.INT); |
4565 |
07 Oct 08 |
nicklas |
436 |
try |
4565 |
07 Oct 08 |
nicklas |
437 |
{ |
4565 |
07 Oct 08 |
nicklas |
438 |
for (Unit u : unitQuery.list(dc)) |
4565 |
07 Oct 08 |
nicklas |
439 |
{ |
4565 |
07 Oct 08 |
nicklas |
440 |
if (mode.hasPropertyLink()) |
4565 |
07 Oct 08 |
nicklas |
441 |
{ |
4565 |
07 Oct 08 |
nicklas |
442 |
out.write(Base.getLink(ID, "1 " + u.getDisplaySymbol(), Item.UNIT, u.getId(), |
4565 |
07 Oct 08 |
nicklas |
443 |
mode.hasEditLink(), u.getName() + "; click to view")); |
4565 |
07 Oct 08 |
nicklas |
444 |
} |
4565 |
07 Oct 08 |
nicklas |
445 |
else |
4565 |
07 Oct 08 |
nicklas |
446 |
{ |
4565 |
07 Oct 08 |
nicklas |
447 |
out.write("1 " + u.getDisplaySymbol()); |
4565 |
07 Oct 08 |
nicklas |
448 |
} |
4565 |
07 Oct 08 |
nicklas |
449 |
out.write(" = "); |
4565 |
07 Oct 08 |
nicklas |
450 |
if (u.getReferenceFactor() != 1.0) |
4565 |
07 Oct 08 |
nicklas |
451 |
{ |
4888 |
06 Apr 09 |
nicklas |
452 |
out.write(u.getReferenceFactor() + " × "); |
4565 |
07 Oct 08 |
nicklas |
453 |
} |
4565 |
07 Oct 08 |
nicklas |
454 |
out.write(item.getReferenceUnit()); |
4565 |
07 Oct 08 |
nicklas |
455 |
if (u.getReferenceOffset() != 0.0) |
4565 |
07 Oct 08 |
nicklas |
456 |
{ |
4565 |
07 Oct 08 |
nicklas |
457 |
out.write(" + " + u.getReferenceOffset()); |
4565 |
07 Oct 08 |
nicklas |
458 |
} |
4565 |
07 Oct 08 |
nicklas |
459 |
out.write("<br>"); |
4565 |
07 Oct 08 |
nicklas |
460 |
} |
4565 |
07 Oct 08 |
nicklas |
461 |
} |
4565 |
07 Oct 08 |
nicklas |
462 |
catch (Throwable t) |
4565 |
07 Oct 08 |
nicklas |
463 |
{ |
4565 |
07 Oct 08 |
nicklas |
464 |
%> |
4565 |
07 Oct 08 |
nicklas |
465 |
<div class="error"><%=t.getMessage()%></div> |
4565 |
07 Oct 08 |
nicklas |
466 |
<% |
4565 |
07 Oct 08 |
nicklas |
467 |
} |
4565 |
07 Oct 08 |
nicklas |
468 |
%> |
4565 |
07 Oct 08 |
nicklas |
469 |
</tbl:cell> |
4543 |
22 Sep 08 |
nicklas |
470 |
<tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
6045 |
03 Apr 12 |
nicklas |
471 |
<tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> |
6045 |
03 Apr 12 |
nicklas |
472 |
<tbl:cell column="xt-columns" /> |
6045 |
03 Apr 12 |
nicklas |
473 |
</tbl:xt-cells> |
4543 |
22 Sep 08 |
nicklas |
474 |
</tbl:row> |
4543 |
22 Sep 08 |
nicklas |
475 |
<% |
4543 |
22 Sep 08 |
nicklas |
476 |
} |
4543 |
22 Sep 08 |
nicklas |
477 |
} |
5954 |
13 Feb 12 |
nicklas |
478 |
if (numListed == 0) |
5954 |
13 Feb 12 |
nicklas |
479 |
{ |
5954 |
13 Feb 12 |
nicklas |
480 |
%> |
6604 |
18 Nov 14 |
nicklas |
481 |
<tbl:panel subclass="bg-filled-50"> |
5954 |
13 Feb 12 |
nicklas |
482 |
<div class="messagecontainer note"> |
5954 |
13 Feb 12 |
nicklas |
483 |
<%=quantities == null || quantities.getTotalCount() == 0 ? "No quantities were found" : "No quantities on this page. Please select another page!" %> |
5954 |
13 Feb 12 |
nicklas |
484 |
</div> |
5954 |
13 Feb 12 |
nicklas |
485 |
</tbl:panel> |
5954 |
13 Feb 12 |
nicklas |
486 |
<% |
5954 |
13 Feb 12 |
nicklas |
487 |
} |
4543 |
22 Sep 08 |
nicklas |
488 |
%> |
5954 |
13 Feb 12 |
nicklas |
489 |
</tbl:rows> |
4543 |
22 Sep 08 |
nicklas |
490 |
</tbl:data> |
4543 |
22 Sep 08 |
nicklas |
491 |
</tbl:table> |
5954 |
13 Feb 12 |
nicklas |
492 |
</div> |
5954 |
13 Feb 12 |
nicklas |
493 |
|
5951 |
09 Feb 12 |
nicklas |
494 |
<base:buttongroup subclass="dialogbuttons"> |
6289 |
05 Jun 13 |
nicklas |
495 |
<base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
6289 |
05 Jun 13 |
nicklas |
496 |
<base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
6289 |
05 Jun 13 |
nicklas |
497 |
<base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
4543 |
22 Sep 08 |
nicklas |
498 |
</base:buttongroup> |
5951 |
09 Feb 12 |
nicklas |
499 |
|
4543 |
22 Sep 08 |
nicklas |
500 |
</base:body> |
4543 |
22 Sep 08 |
nicklas |
501 |
</base:page> |
4543 |
22 Sep 08 |
nicklas |
502 |
<% |
4543 |
22 Sep 08 |
nicklas |
503 |
} |
4543 |
22 Sep 08 |
nicklas |
504 |
finally |
4543 |
22 Sep 08 |
nicklas |
505 |
{ |
4543 |
22 Sep 08 |
nicklas |
506 |
if (quantities != null) quantities.close(); |
4543 |
22 Sep 08 |
nicklas |
507 |
if (dc != null) dc.close(); |
4543 |
22 Sep 08 |
nicklas |
508 |
} |
4543 |
22 Sep 08 |
nicklas |
509 |
%> |