1 | <%-- $Id: list_formulas.jsp 5951 2012-02-09 14:19:17Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
---|
4 | Copyright (C) 2007 Johan Enell, Nicklas Nordborg, Martin Svensson |
---|
5 | |
---|
6 | This file is part of BASE - BioArray Software Environment. |
---|
7 | Available at http://base.thep.lu.se/ |
---|
8 | |
---|
9 | BASE is free software; you can redistribute it and/or |
---|
10 | modify it under the terms of the GNU General Public License |
---|
11 | as published by the Free Software Foundation; either version 3 |
---|
12 | of the License, or (at your option) any later version. |
---|
13 | |
---|
14 | BASE is distributed in the hope that it will be useful, |
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | GNU General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU General Public License |
---|
20 | along with BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | ------------------------------------------------------------------ |
---|
22 | |
---|
23 | @author Nicklas |
---|
24 | @version 2.0 |
---|
25 | --%> |
---|
26 | <%@ page pageEncoding="UTF-8" session="false" |
---|
27 | import="net.sf.basedb.core.SessionControl" |
---|
28 | import="net.sf.basedb.core.DbControl" |
---|
29 | import="net.sf.basedb.core.Item" |
---|
30 | import="net.sf.basedb.core.Formula" |
---|
31 | import="net.sf.basedb.core.Type" |
---|
32 | import="net.sf.basedb.core.IntensityTransform" |
---|
33 | import="net.sf.basedb.core.ItemQuery" |
---|
34 | import="net.sf.basedb.core.ItemResultIterator" |
---|
35 | import="net.sf.basedb.core.ItemContext" |
---|
36 | import="net.sf.basedb.core.Nameable" |
---|
37 | import="net.sf.basedb.core.Permission" |
---|
38 | import="net.sf.basedb.core.RawDataTypes" |
---|
39 | import="net.sf.basedb.core.RawDataType" |
---|
40 | import="net.sf.basedb.core.PluginDefinition" |
---|
41 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
42 | import="net.sf.basedb.core.plugin.Plugin" |
---|
43 | import="net.sf.basedb.util.Enumeration" |
---|
44 | import="net.sf.basedb.util.ShareableUtil" |
---|
45 | import="net.sf.basedb.clients.web.Base" |
---|
46 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
47 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
48 | import="net.sf.basedb.clients.web.util.HTML" |
---|
49 | import="net.sf.basedb.util.Values" |
---|
50 | import="net.sf.basedb.util.formatter.Formatter" |
---|
51 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
52 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
53 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
54 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
55 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
56 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
57 | import="java.util.Date" |
---|
58 | import="java.util.Iterator" |
---|
59 | import="java.util.List" |
---|
60 | import="java.util.Map" |
---|
61 | %> |
---|
62 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
63 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
64 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
65 | <%! |
---|
66 | private static final Item itemType = Item.FORMULA; |
---|
67 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
68 | |
---|
69 | private static final Enumeration<String, String> types = new Enumeration<String, String>(); |
---|
70 | private static final Enumeration<String, String> parsers = new Enumeration<String, String>(); |
---|
71 | private static final Enumeration<String, String> avgMethods = new Enumeration<String, String>(); |
---|
72 | private static final Enumeration<String, String> transforms = new Enumeration<String, String>(); |
---|
73 | private static final Enumeration<String, String> rawEnumeration = new Enumeration<String, String>(); |
---|
74 | private static final Enumeration<String, String> valueTypes = new Enumeration<String, String>(); |
---|
75 | static |
---|
76 | { |
---|
77 | for (Formula.Type t : Formula.Type.values()) |
---|
78 | { |
---|
79 | types.add(Integer.toString(t.getValue()), HTML.encodeTags(t.toString())); |
---|
80 | } |
---|
81 | valueTypes.add("", "- unknown -"); |
---|
82 | for (Type v : Type.values()) |
---|
83 | { |
---|
84 | valueTypes.add(Integer.toString(v.getValue()), v.toString()); |
---|
85 | } |
---|
86 | for (Formula.Parser p : Formula.Parser.values()) |
---|
87 | { |
---|
88 | parsers.add(Integer.toString(p.getValue()), HTML.encodeTags(p.toString())); |
---|
89 | } |
---|
90 | for (Formula.AverageMethod m : Formula.AverageMethod.values()) |
---|
91 | { |
---|
92 | avgMethods.add(Integer.toString(m.getValue()), HTML.encodeTags(m.toString())); |
---|
93 | } |
---|
94 | transforms.add("", "- any -"); |
---|
95 | for (IntensityTransform t : IntensityTransform.values()) |
---|
96 | { |
---|
97 | transforms.add(Integer.toString(t.getValue()), HTML.encodeTags(t.toString())); |
---|
98 | } |
---|
99 | rawEnumeration.add("", "- none -"); |
---|
100 | for (RawDataType rdt : RawDataTypes.getRawDataTypes()) |
---|
101 | { |
---|
102 | rawEnumeration.add(rdt.getId(), HTML.encodeTags(rdt.getName())); |
---|
103 | } |
---|
104 | rawEnumeration.sortValues(); |
---|
105 | } |
---|
106 | %> |
---|
107 | <% |
---|
108 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
109 | final String ID = sc.getId(); |
---|
110 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
111 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
112 | |
---|
113 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
114 | final String callback = request.getParameter("callback"); |
---|
115 | final String title = mode.generateTitle("formula", "formulas"); |
---|
116 | final DbControl dc = sc.newDbControl(); |
---|
117 | ItemResultIterator<Formula> formulas = null; |
---|
118 | try |
---|
119 | { |
---|
120 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
121 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
122 | try |
---|
123 | { |
---|
124 | final ItemQuery<Formula> query = Base.getConfiguredQuery(dc, cc, true, Formula.getQuery(), mode); |
---|
125 | formulas = query.iterate(dc); |
---|
126 | } |
---|
127 | catch (Throwable t) |
---|
128 | { |
---|
129 | t.printStackTrace(); |
---|
130 | cc.setMessage(t.getMessage()); |
---|
131 | } |
---|
132 | int numListed = 0; |
---|
133 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
134 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
135 | %> |
---|
136 | <base:page title="<%=title==null ? "Formulas" : title%>" type="<%=mode.getPageType()%>"> |
---|
137 | <base:head scripts="menu.js,table.js" styles="menu.css,table.css,toolbar.css"> |
---|
138 | <ext:scripts context="<%=jspContext%>" /> |
---|
139 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
140 | <script language="JavaScript"> |
---|
141 | var submitPage = 'index.jsp'; |
---|
142 | var formId = 'formulas'; |
---|
143 | function newItem() |
---|
144 | { |
---|
145 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true); |
---|
146 | } |
---|
147 | function editItem(itemId) |
---|
148 | { |
---|
149 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true); |
---|
150 | } |
---|
151 | function viewItem(itemId) |
---|
152 | { |
---|
153 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false); |
---|
154 | } |
---|
155 | function itemOnClick(evt, itemId) |
---|
156 | { |
---|
157 | Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected); |
---|
158 | } |
---|
159 | function deleteItems() |
---|
160 | { |
---|
161 | var frm = document.forms[formId]; |
---|
162 | if (Forms.numChecked(frm) == 0) |
---|
163 | { |
---|
164 | alert('Please select at least one item in the list'); |
---|
165 | return; |
---|
166 | } |
---|
167 | frm.action = submitPage; |
---|
168 | frm.cmd.value = 'DeleteItems'; |
---|
169 | frm.submit(); |
---|
170 | } |
---|
171 | function restoreItems() |
---|
172 | { |
---|
173 | var frm = document.forms[formId]; |
---|
174 | if (Forms.numChecked(frm) == 0) |
---|
175 | { |
---|
176 | alert('Please select at least one item in the list'); |
---|
177 | return; |
---|
178 | } |
---|
179 | frm.action = submitPage; |
---|
180 | frm.cmd.value = 'RestoreItems'; |
---|
181 | frm.submit(); |
---|
182 | } |
---|
183 | function deleteItemPermanently(itemId) |
---|
184 | { |
---|
185 | Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId); |
---|
186 | } |
---|
187 | function setOwner() |
---|
188 | { |
---|
189 | Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems'); |
---|
190 | } |
---|
191 | function shareItem(itemId) |
---|
192 | { |
---|
193 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id='+itemId, 'ShareItem', 600, 400); |
---|
194 | } |
---|
195 | function shareItems() |
---|
196 | { |
---|
197 | Table.shareItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'ShareItems'); |
---|
198 | } |
---|
199 | function configureColumns() |
---|
200 | { |
---|
201 | Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
202 | } |
---|
203 | function runPlugin(cmd) |
---|
204 | { |
---|
205 | Table.submitToPopup(formId, cmd, 750, 500); |
---|
206 | } |
---|
207 | function returnSelected() |
---|
208 | { |
---|
209 | Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>); |
---|
210 | window.close(); |
---|
211 | } |
---|
212 | function presetOnChange() |
---|
213 | { |
---|
214 | Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>'); |
---|
215 | } |
---|
216 | </script> |
---|
217 | </base:head> |
---|
218 | |
---|
219 | <base:body> |
---|
220 | <% |
---|
221 | if (cc.getMessage() != null) |
---|
222 | { |
---|
223 | %> |
---|
224 | <div class="error"><%=cc.getMessage()%></div> |
---|
225 | <% |
---|
226 | cc.setMessage(null); |
---|
227 | } |
---|
228 | %> |
---|
229 | <tbl:table |
---|
230 | id="formulas" |
---|
231 | |
---|
232 | columns="<%=cc.getSetting("columns")%>" |
---|
233 | sortby="<%=cc.getSortProperty()%>" |
---|
234 | direction="<%=cc.getSortDirection()%>" |
---|
235 | title="<%=title%>" |
---|
236 | action="index.jsp" |
---|
237 | sc="<%=sc%>" |
---|
238 | item="<%=itemType%>" |
---|
239 | > |
---|
240 | <tbl:hidden |
---|
241 | name="mode" |
---|
242 | value="<%=mode.getName()%>" |
---|
243 | /> |
---|
244 | <tbl:hidden |
---|
245 | name="callback" |
---|
246 | value="<%=callback%>" |
---|
247 | skip="<%=callback == null%>" |
---|
248 | /> |
---|
249 | <tbl:columndef |
---|
250 | id="name" |
---|
251 | property="name" |
---|
252 | datatype="string" |
---|
253 | title="Name" |
---|
254 | sortable="true" |
---|
255 | filterable="true" |
---|
256 | exportable="true" |
---|
257 | show="always" |
---|
258 | /> |
---|
259 | <tbl:columndef |
---|
260 | id="id" |
---|
261 | clazz="uniquecol" |
---|
262 | property="id" |
---|
263 | datatype="int" |
---|
264 | title="ID" |
---|
265 | sortable="true" |
---|
266 | filterable="true" |
---|
267 | exportable="true" |
---|
268 | /> |
---|
269 | <tbl:columndef |
---|
270 | id="entryDate" |
---|
271 | property="entryDate" |
---|
272 | datatype="date" |
---|
273 | title="Registered" |
---|
274 | sortable="true" |
---|
275 | filterable="true" |
---|
276 | exportable="true" |
---|
277 | formatter="<%=dateFormatter%>" |
---|
278 | /> |
---|
279 | <tbl:columndef |
---|
280 | id="type" |
---|
281 | property="type" |
---|
282 | datatype="int" |
---|
283 | enumeration="<%=types%>" |
---|
284 | title="Type" |
---|
285 | sortable="true" |
---|
286 | filterable="true" |
---|
287 | exportable="true" |
---|
288 | /> |
---|
289 | <tbl:columndef |
---|
290 | id="parser" |
---|
291 | property="parser" |
---|
292 | datatype="int" |
---|
293 | enumeration="<%=parsers%>" |
---|
294 | title="Parser" |
---|
295 | sortable="true" |
---|
296 | filterable="true" |
---|
297 | exportable="true" |
---|
298 | /> |
---|
299 | <tbl:columndef |
---|
300 | id="valueType" |
---|
301 | property="valueType" |
---|
302 | datatype="int" |
---|
303 | enumeration="<%=valueTypes%>" |
---|
304 | title="Value type" |
---|
305 | sortable="true" |
---|
306 | filterable="true" |
---|
307 | exportable="true" |
---|
308 | /> |
---|
309 | <tbl:columndef |
---|
310 | id="averageMethod" |
---|
311 | property="averageMethod" |
---|
312 | datatype="int" |
---|
313 | enumeration="<%=avgMethods%>" |
---|
314 | title="Avg. method" |
---|
315 | sortable="true" |
---|
316 | filterable="true" |
---|
317 | exportable="true" |
---|
318 | /> |
---|
319 | <tbl:columndef |
---|
320 | id="sourceIntensityTransform" |
---|
321 | property="sourceIntensityTransform" |
---|
322 | datatype="int" |
---|
323 | enumeration="<%=transforms%>" |
---|
324 | title="Source intensity transform" |
---|
325 | sortable="true" |
---|
326 | filterable="true" |
---|
327 | exportable="true" |
---|
328 | /> |
---|
329 | <tbl:columndef |
---|
330 | id="resultIntensityTransform" |
---|
331 | property="resultIntensityTransform" |
---|
332 | datatype="int" |
---|
333 | enumeration="<%=transforms%>" |
---|
334 | title="Result intensity transform" |
---|
335 | sortable="true" |
---|
336 | filterable="true" |
---|
337 | exportable="true" |
---|
338 | /> |
---|
339 | <tbl:columndef |
---|
340 | id="rawDataType" |
---|
341 | property="rawDataType" |
---|
342 | datatype="string" |
---|
343 | enumeration="<%=rawEnumeration%>" |
---|
344 | title="Raw data type" |
---|
345 | sortable="true" |
---|
346 | filterable="true" |
---|
347 | exportable="true" |
---|
348 | /> |
---|
349 | <tbl:columndef |
---|
350 | id="channels" |
---|
351 | property="channels" |
---|
352 | datatype="int" |
---|
353 | title="Channels" |
---|
354 | sortable="true" |
---|
355 | filterable="true" |
---|
356 | exportable="true" |
---|
357 | /> |
---|
358 | <tbl:columndef |
---|
359 | id="formulas" |
---|
360 | property="formulas" |
---|
361 | datatype="string" |
---|
362 | title="Formulas" |
---|
363 | sortable="false" |
---|
364 | filterable="false" |
---|
365 | exportable="true" |
---|
366 | /> |
---|
367 | <tbl:columndef |
---|
368 | id="useColors" |
---|
369 | property="coloring#usingColors" |
---|
370 | datatype="boolean" |
---|
371 | title="Use colors" |
---|
372 | sortable="true" |
---|
373 | filterable="true" |
---|
374 | exportable="true" |
---|
375 | /> |
---|
376 | <tbl:columndef |
---|
377 | id="logarithmic" |
---|
378 | property="coloring#logarithmic" |
---|
379 | datatype="boolean" |
---|
380 | title="Logarithmic" |
---|
381 | sortable="true" |
---|
382 | filterable="true" |
---|
383 | exportable="true" |
---|
384 | /> |
---|
385 | <tbl:columndef |
---|
386 | id="minValue" |
---|
387 | property="coloring#minValue" |
---|
388 | datatype="float" |
---|
389 | title="Min value" |
---|
390 | sortable="true" |
---|
391 | filterable="true" |
---|
392 | exportable="true" |
---|
393 | /> |
---|
394 | <tbl:columndef |
---|
395 | id="midValue" |
---|
396 | property="coloring#midValue" |
---|
397 | datatype="float" |
---|
398 | title="Mid value" |
---|
399 | sortable="true" |
---|
400 | filterable="true" |
---|
401 | exportable="true" |
---|
402 | /> |
---|
403 | <tbl:columndef |
---|
404 | id="maxValue" |
---|
405 | property="coloring#maxValue" |
---|
406 | datatype="float" |
---|
407 | title="Max value" |
---|
408 | sortable="true" |
---|
409 | filterable="true" |
---|
410 | exportable="true" |
---|
411 | /> |
---|
412 | <tbl:columndef |
---|
413 | id="owner" |
---|
414 | property="owner.name" |
---|
415 | datatype="string" |
---|
416 | title="Owner" |
---|
417 | sortable="true" |
---|
418 | filterable="true" |
---|
419 | exportable="true" |
---|
420 | /> |
---|
421 | <tbl:columndef |
---|
422 | id="description" |
---|
423 | property="description" |
---|
424 | datatype="string" |
---|
425 | title="Description" |
---|
426 | sortable="true" |
---|
427 | filterable="true" |
---|
428 | exportable="true" |
---|
429 | /> |
---|
430 | <tbl:columndef |
---|
431 | id="permission" |
---|
432 | title="Permission" |
---|
433 | /> |
---|
434 | <tbl:columndef |
---|
435 | id="sharedTo" |
---|
436 | title="Shared to" |
---|
437 | filterable="true" |
---|
438 | filterproperty="!sharedTo.name" |
---|
439 | datatype="string" |
---|
440 | /> |
---|
441 | <tbl:toolbar |
---|
442 | visible="<%=mode.hasToolbar()%>" |
---|
443 | > |
---|
444 | <tbl:button |
---|
445 | disabled="<%=!createPermission%>" |
---|
446 | image="new.png" |
---|
447 | onclick="newItem()" |
---|
448 | title="New…" |
---|
449 | tooltip="<%=createPermission ? "Create new formula" : "You do not have permission to create formulas"%>" |
---|
450 | /> |
---|
451 | <tbl:button |
---|
452 | image="delete.png" |
---|
453 | onclick="deleteItems()" |
---|
454 | title="Delete" |
---|
455 | tooltip="Delete the selected items" |
---|
456 | /> |
---|
457 | <tbl:button |
---|
458 | image="restore.png" |
---|
459 | onclick="restoreItems()" |
---|
460 | title="Restore" |
---|
461 | tooltip="Restore the selected (deleted) items" |
---|
462 | /> |
---|
463 | <tbl:button |
---|
464 | image="share.png" |
---|
465 | onclick="shareItems()" |
---|
466 | title="Share…" |
---|
467 | tooltip="Share the selected items" |
---|
468 | /> |
---|
469 | <tbl:button |
---|
470 | image="take_ownership.png" |
---|
471 | onclick="setOwner()" |
---|
472 | title="Set owner…" |
---|
473 | tooltip="Change owner of the selected items" |
---|
474 | /> |
---|
475 | <tbl:button |
---|
476 | image="columns.png" |
---|
477 | onclick="configureColumns()" |
---|
478 | title="Columns…" |
---|
479 | tooltip="Show, hide and re-order columns" |
---|
480 | /> |
---|
481 | <tbl:button |
---|
482 | image="import.png" |
---|
483 | onclick="runPlugin('ImportItems')" |
---|
484 | title="Import…" |
---|
485 | tooltip="Import data" |
---|
486 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
487 | /> |
---|
488 | <tbl:button |
---|
489 | image="export.png" |
---|
490 | onclick="runPlugin('ExportItems')" |
---|
491 | title="Export…" |
---|
492 | tooltip="Export data" |
---|
493 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
494 | /> |
---|
495 | <tbl:button |
---|
496 | image="runplugin.png" |
---|
497 | onclick="runPlugin('RunListPlugin')" |
---|
498 | title="Run plugin…" |
---|
499 | tooltip="Run a plugin" |
---|
500 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
501 | /> |
---|
502 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
503 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
504 | </tbl:toolbar> |
---|
505 | <tbl:navigator |
---|
506 | page="<%=cc.getPage()%>" |
---|
507 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
508 | totalrows="<%=formulas == null ? 0 : formulas.getTotalCount()%>" |
---|
509 | visible="<%=mode.hasNavigator()%>" |
---|
510 | /> |
---|
511 | <tbl:data> |
---|
512 | <tbl:headers> |
---|
513 | <tbl:headerrow> |
---|
514 | <tbl:header colspan="3" /> |
---|
515 | <tbl:columnheaders /> |
---|
516 | </tbl:headerrow> |
---|
517 | <tbl:headerrow> |
---|
518 | <tbl:header subclass="index" /> |
---|
519 | <tbl:header |
---|
520 | subclass="check" |
---|
521 | visible="<%=mode.hasCheck()%>" |
---|
522 | ><base:icon |
---|
523 | image="check_uncheck.png" |
---|
524 | tooltip="Check/uncheck all" |
---|
525 | onclick="Forms.checkUncheck(document.forms[formId])" |
---|
526 | /></tbl:header> |
---|
527 | <tbl:header |
---|
528 | subclass="check" |
---|
529 | visible="<%=mode.hasRadio()%>" |
---|
530 | /> |
---|
531 | <tbl:header |
---|
532 | subclass="icons" |
---|
533 | visible="<%=mode.hasIcons()%>" |
---|
534 | /> |
---|
535 | <tbl:propertyfilter /> |
---|
536 | </tbl:headerrow> |
---|
537 | </tbl:headers> |
---|
538 | <tbl:rows> |
---|
539 | <% |
---|
540 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
541 | int selectedItemId = cc.getId(); |
---|
542 | if (formulas != null) |
---|
543 | { |
---|
544 | while (formulas.hasNext()) |
---|
545 | { |
---|
546 | Formula item = formulas.next(); |
---|
547 | RawDataType rawDataType = item.getRawDataType(); |
---|
548 | List<String> expressions = item.getFormulas(); |
---|
549 | int itemId = item.getId(); |
---|
550 | String openSharePopup = "shareItem("+itemId+")"; |
---|
551 | String deletePermanently = "deleteItemPermanently("+itemId+")"; |
---|
552 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
553 | boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); |
---|
554 | boolean writePermission = item.hasPermission(Permission.WRITE); |
---|
555 | String tooltip = mode.isSelectionMode() ? |
---|
556 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
557 | String name = HTML.encodeTags(item.getName()); |
---|
558 | index++; |
---|
559 | numListed++; |
---|
560 | %> |
---|
561 | <tbl:row> |
---|
562 | <tbl:header |
---|
563 | clazz="index" |
---|
564 | ><%=index%></tbl:header> |
---|
565 | <tbl:header |
---|
566 | clazz="check" |
---|
567 | visible="<%=mode.hasCheck()%>" |
---|
568 | ><input |
---|
569 | type="checkbox" |
---|
570 | name="<%=itemId%>" |
---|
571 | value="<%=itemId%>" |
---|
572 | title="<%=name%>" |
---|
573 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
574 | ></tbl:header> |
---|
575 | <tbl:header |
---|
576 | clazz="check" |
---|
577 | visible="<%=mode.hasRadio()%>" |
---|
578 | ><input |
---|
579 | type="radio" |
---|
580 | name="item_id" |
---|
581 | value="<%=itemId%>" |
---|
582 | title="<%=name%>" |
---|
583 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
584 | ></tbl:header> |
---|
585 | <tbl:header |
---|
586 | clazz="icons" |
---|
587 | visible="<%=mode.hasIcons()%>" |
---|
588 | ><base:icon |
---|
589 | image="deleted.png" |
---|
590 | onclick="<%=deletePermission ? deletePermanently : null%>" |
---|
591 | tooltip="This item has been scheduled for deletion" |
---|
592 | visible="<%=item.isRemoved()%>" |
---|
593 | /><base:icon |
---|
594 | image="shared.png" |
---|
595 | onclick="<%=sharePermission ? openSharePopup : null%>" |
---|
596 | tooltip="This item is shared to other users, groups and/or projects" |
---|
597 | visible="<%=item.isShared()%>" |
---|
598 | /> </tbl:header> |
---|
599 | <tbl:cell column="name"><div class="link" |
---|
600 | onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" |
---|
601 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
602 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
603 | <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" /> |
---|
604 | <tbl:cell column="type"><%=item.getFormulaType().toString()%></tbl:cell> |
---|
605 | <tbl:cell column="parser"><%=item.getParser().toString()%></tbl:cell> |
---|
606 | <tbl:cell column="valueType"><%=item.getValueType() == null ? "<i>- unknown -</i>" : item.getValueType()%></tbl:cell> |
---|
607 | <tbl:cell column="averageMethod"><%=item.getAverageMethod().toString()%></tbl:cell> |
---|
608 | <tbl:cell column="sourceIntensityTransform"><%=item.getSourceIntensityTransform() == null ? "<i>- any -</i>" : item.getSourceIntensityTransform().toString()%></tbl:cell> |
---|
609 | <tbl:cell column="resultIntensityTransform"><%=item.getResultIntensityTransform() == null ? "<i>- any -</i>" : item.getResultIntensityTransform().toString()%></tbl:cell> |
---|
610 | <tbl:cell column="rawDataType"><%=rawDataType == null ? "<i>- none -</i>" : HTML.encodeTags(rawDataType.getName())%></tbl:cell> |
---|
611 | <tbl:cell column="channels"><%=item.getChannels()%></tbl:cell> |
---|
612 | <tbl:cell column="formulas"> |
---|
613 | <% |
---|
614 | for (int i = 0; i < expressions.size(); ++i) |
---|
615 | { |
---|
616 | %> |
---|
617 | <%=(i+1) + ": " + HTML.encodeTags(expressions.get(i))%><br> |
---|
618 | <% |
---|
619 | } |
---|
620 | %> |
---|
621 | </tbl:cell> |
---|
622 | <tbl:cell column="owner" |
---|
623 | ><base:propertyvalue |
---|
624 | item="<%=item%>" |
---|
625 | property="owner" |
---|
626 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
627 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
628 | /></tbl:cell> |
---|
629 | <tbl:cell column="useColors"><%=item.getColoring().isUsingColors() ? "yes" : "no"%></tbl:cell> |
---|
630 | <tbl:cell column="logarithmic"><%=item.getColoring().isLogarithmic() ? "yes" : "no"%></tbl:cell> |
---|
631 | <tbl:cell column="minValue"><%=Values.formatNumber(item.getColoring().getMinValue(), 2)%></tbl:cell> |
---|
632 | <tbl:cell column="midValue"><%=Values.formatNumber(item.getColoring().getMidValue(), 2)%></tbl:cell> |
---|
633 | <tbl:cell column="maxValue"><%=Values.formatNumber(item.getColoring().getMaxValue(), 2)%></tbl:cell> |
---|
634 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
635 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
636 | <tbl:cell column="sharedTo"> |
---|
637 | <% |
---|
638 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
639 | while(sharees.hasNext()) |
---|
640 | { |
---|
641 | Nameable n = sharees.next(); |
---|
642 | if (mode.hasPropertyLink()) |
---|
643 | { |
---|
644 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
645 | } |
---|
646 | else |
---|
647 | { |
---|
648 | out.write(HTML.encodeTags(n.getName())); |
---|
649 | } |
---|
650 | out.write(sharees.hasNext() ? ", " : ""); |
---|
651 | } |
---|
652 | %> |
---|
653 | </tbl:cell> |
---|
654 | </tbl:row> |
---|
655 | <% |
---|
656 | } |
---|
657 | } |
---|
658 | %> |
---|
659 | </tbl:rows> |
---|
660 | </tbl:data> |
---|
661 | <% |
---|
662 | if (numListed == 0) |
---|
663 | { |
---|
664 | %> |
---|
665 | <tbl:panel><%=formulas == null || formulas.getTotalCount() == 0 ? "No formulas were found" : "No formulas on this page. Please select another page!" %></tbl:panel> |
---|
666 | <% |
---|
667 | } |
---|
668 | else |
---|
669 | { |
---|
670 | %> |
---|
671 | <tbl:navigator |
---|
672 | page="<%=cc.getPage()%>" |
---|
673 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
674 | totalrows="<%=formulas == null ? 0 : formulas.getTotalCount()%>" |
---|
675 | visible="<%=mode.hasNavigator()%>" |
---|
676 | locked="true" |
---|
677 | /> |
---|
678 | <% |
---|
679 | } |
---|
680 | %> |
---|
681 | </tbl:table> |
---|
682 | <base:buttongroup subclass="dialogbuttons"> |
---|
683 | <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
684 | <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
685 | <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
686 | </base:buttongroup> |
---|
687 | |
---|
688 | </base:body> |
---|
689 | </base:page> |
---|
690 | <% |
---|
691 | } |
---|
692 | finally |
---|
693 | { |
---|
694 | if (formulas != null) formulas.close(); |
---|
695 | if (dc != null) dc.close(); |
---|
696 | } |
---|
697 | %> |
---|