1 | <%-- $Id: list_annotationtypes.jsp 7914 2021-02-23 07:23:26Z 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.AnnotationType" |
---|
31 | import="net.sf.basedb.core.AnnotationTypeCategory" |
---|
32 | import="net.sf.basedb.core.Quantity" |
---|
33 | import="net.sf.basedb.core.ItemQuery" |
---|
34 | import="net.sf.basedb.core.Include" |
---|
35 | import="net.sf.basedb.core.Type" |
---|
36 | import="net.sf.basedb.core.Metadata" |
---|
37 | import="net.sf.basedb.core.ItemResultIterator" |
---|
38 | import="net.sf.basedb.core.ItemResultList" |
---|
39 | import="net.sf.basedb.core.ItemContext" |
---|
40 | import="net.sf.basedb.core.Nameable" |
---|
41 | import="net.sf.basedb.core.Permission" |
---|
42 | import="net.sf.basedb.core.PluginDefinition" |
---|
43 | import="net.sf.basedb.core.query.Restrictions" |
---|
44 | import="net.sf.basedb.core.query.Expressions" |
---|
45 | import="net.sf.basedb.core.query.Orders" |
---|
46 | import="net.sf.basedb.core.query.Hql" |
---|
47 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
48 | import="net.sf.basedb.core.plugin.Plugin" |
---|
49 | import="net.sf.basedb.util.Enumeration" |
---|
50 | import="net.sf.basedb.util.ShareableUtil" |
---|
51 | import="net.sf.basedb.clients.web.Base" |
---|
52 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
53 | import="net.sf.basedb.clients.web.ModeInfo" |
---|
54 | import="net.sf.basedb.clients.web.util.HTML" |
---|
55 | import="net.sf.basedb.util.Values" |
---|
56 | import="net.sf.basedb.util.formatter.Formatter" |
---|
57 | import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
---|
58 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
59 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
60 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
61 | import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" |
---|
62 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
63 | import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
---|
64 | import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
---|
65 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
66 | import="java.util.Date" |
---|
67 | import="java.util.Iterator" |
---|
68 | import="java.util.List" |
---|
69 | import="java.util.Map" |
---|
70 | import="java.util.Set" |
---|
71 | import="java.util.EnumSet" |
---|
72 | %> |
---|
73 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
74 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
75 | <%@ taglib prefix="m" uri="/WEB-INF/menu.tld" %> |
---|
76 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
77 | <%! |
---|
78 | private static final Item itemType = Item.ANNOTATIONTYPE; |
---|
79 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST); |
---|
80 | |
---|
81 | private static final Enumeration<String, String> items = new Enumeration<String, String>(); |
---|
82 | private static Enumeration<String, String> types = new Enumeration<String, String>(); |
---|
83 | static |
---|
84 | { |
---|
85 | items.add("", "- none -"); |
---|
86 | for (Item item : Metadata.getAnnotatableItems()) |
---|
87 | { |
---|
88 | items.add(Integer.toString(item.getValue()), item.toString()); |
---|
89 | } |
---|
90 | for (Type v : Type.values()) |
---|
91 | { |
---|
92 | types.add(Integer.toString(v.getValue()), v.toString()); |
---|
93 | } |
---|
94 | } |
---|
95 | %> |
---|
96 | <% |
---|
97 | final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType); |
---|
98 | final String ID = sc.getId(); |
---|
99 | final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType); |
---|
100 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
101 | |
---|
102 | final ModeInfo mode = ModeInfo.get(request.getParameter("mode")); |
---|
103 | final String callback = request.getParameter("callback"); |
---|
104 | final String title = mode.generateTitle("annotation type", "annotation types"); |
---|
105 | final DbControl dc = sc.newDbControl(); |
---|
106 | ItemResultIterator<AnnotationType> annotationTypes = null; |
---|
107 | try |
---|
108 | { |
---|
109 | Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
---|
110 | // Query for categories of the current annotation type |
---|
111 | final ItemQuery<AnnotationTypeCategory> categoryQuery = AnnotationTypeCategory.getQuery(); |
---|
112 | categoryQuery.include(cc.getInclude()); |
---|
113 | categoryQuery.join(Hql.innerJoin("annotationTypes", "atp")); |
---|
114 | categoryQuery.restrict(Restrictions.eq(Hql.alias("atp"), Expressions.parameter("annotationType"))); |
---|
115 | categoryQuery.order(Orders.asc(Hql.property("name"))); |
---|
116 | |
---|
117 | // Get all quantities |
---|
118 | final ItemQuery<Quantity> quantityQuery = Quantity.getQuery(); |
---|
119 | quantityQuery.order(Orders.asc(Hql.property("name"))); |
---|
120 | quantityQuery.setCacheResult(true); |
---|
121 | |
---|
122 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
123 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null); |
---|
124 | try |
---|
125 | { |
---|
126 | final ItemQuery<AnnotationType> query = Base.getConfiguredQuery(dc, cc, jspContext, true, AnnotationType.getQuery(null), mode); |
---|
127 | annotationTypes = query.iterate(dc); |
---|
128 | } |
---|
129 | catch (Throwable ex) |
---|
130 | { |
---|
131 | cc.setMessage(ex.getMessage()); |
---|
132 | } |
---|
133 | int numListed = 0; |
---|
134 | ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext); |
---|
135 | ExtensionsInvoker<ListColumnAction<AnnotationType,?>> columnsInvoker = ListColumnUtil.useExtensions(jspContext); |
---|
136 | %> |
---|
137 | <base:page title="<%=title==null ? "Annotation types" : title%>" type="<%=mode.getPageType()%>" id="list-page"> |
---|
138 | <base:head scripts="table.js,~annotationtypes.js" styles="table.css,toolbar.css"> |
---|
139 | <ext:scripts context="<%=jspContext%>" /> |
---|
140 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
141 | </base:head> |
---|
142 | |
---|
143 | <base:body> |
---|
144 | <m:menu |
---|
145 | id="mnuNewAnnotationType" |
---|
146 | style="display: none;"> |
---|
147 | <% |
---|
148 | Set<Type> separator = EnumSet.of(Type.DOUBLE, Type.TEXT, Type.BOOLEAN); |
---|
149 | for (Type valueType : Type.values()) |
---|
150 | { |
---|
151 | %> |
---|
152 | <m:menuitem |
---|
153 | title="<%=valueType.toString()+" annotation type"%>" |
---|
154 | data-value-type="<%=valueType.name() %>" |
---|
155 | /> |
---|
156 | <% |
---|
157 | if (separator.contains(valueType)) |
---|
158 | { |
---|
159 | %> |
---|
160 | <m:menuseparator /> |
---|
161 | <% |
---|
162 | } |
---|
163 | } |
---|
164 | %> |
---|
165 | </m:menu> |
---|
166 | <h1><%=title==null ? "Annotation types" : title%></h1> |
---|
167 | <div class="content"> |
---|
168 | <tbl:table |
---|
169 | id="annotationTypes" |
---|
170 | columns="<%=cc.getSetting("columns")%>" |
---|
171 | sortby="<%=cc.getSortProperty()%>" |
---|
172 | direction="<%=cc.getSortDirection()%>" |
---|
173 | action="index.jsp" |
---|
174 | sc="<%=sc%>" |
---|
175 | item="<%=itemType%>" |
---|
176 | filterrows="<%=cc.getFilterRows()%>" |
---|
177 | subclass="fulltable" |
---|
178 | > |
---|
179 | <tbl:hidden |
---|
180 | name="mode" |
---|
181 | value="<%=mode.getName()%>" |
---|
182 | /> |
---|
183 | <tbl:hidden |
---|
184 | name="callback" |
---|
185 | value="<%=callback%>" |
---|
186 | skip="<%=callback == null%>" |
---|
187 | /> |
---|
188 | <tbl:columndef |
---|
189 | id="name" |
---|
190 | property="name" |
---|
191 | datatype="string" |
---|
192 | title="Name" |
---|
193 | sortable="true" |
---|
194 | filterable="true" |
---|
195 | exportable="true" |
---|
196 | show="always" |
---|
197 | /> |
---|
198 | <tbl:columndef |
---|
199 | id="id" |
---|
200 | clazz="uniquecol" |
---|
201 | property="id" |
---|
202 | datatype="int" |
---|
203 | title="ID" |
---|
204 | sortable="true" |
---|
205 | filterable="true" |
---|
206 | exportable="true" |
---|
207 | /> |
---|
208 | <tbl:columndef |
---|
209 | id="entryDate" |
---|
210 | property="entryDate" |
---|
211 | datatype="date" |
---|
212 | title="Registered" |
---|
213 | sortable="true" |
---|
214 | filterable="true" |
---|
215 | exportable="true" |
---|
216 | formatter="<%=dateFormatter%>" |
---|
217 | /> |
---|
218 | <tbl:columndef |
---|
219 | id="externalId" |
---|
220 | property="externalId" |
---|
221 | datatype="string" |
---|
222 | title="External id" |
---|
223 | sortable="true" |
---|
224 | filterable="true" |
---|
225 | exportable="true" |
---|
226 | /> |
---|
227 | <tbl:columndef |
---|
228 | id="valueType" |
---|
229 | property="valueType" |
---|
230 | datatype="int" |
---|
231 | enumeration="<%=types%>" |
---|
232 | title="Value type" |
---|
233 | sortable="true" |
---|
234 | filterable="true" |
---|
235 | exportable="true" |
---|
236 | /> |
---|
237 | <% |
---|
238 | Enumeration<String, String> quantities = new Enumeration<String, String>(); |
---|
239 | quantities.add("", "- none -"); |
---|
240 | for (Quantity q : quantityQuery.list(dc)) |
---|
241 | { |
---|
242 | quantities.add(Integer.toString(q.getId()), q.getName()); |
---|
243 | } |
---|
244 | %> |
---|
245 | <tbl:columndef |
---|
246 | id="quantity" |
---|
247 | property="quantity" |
---|
248 | sortproperty="quantity.name" |
---|
249 | exportproperty="quantity.name:string" |
---|
250 | datatype="int" |
---|
251 | enumeration="<%=quantities%>" |
---|
252 | title="Quantity" |
---|
253 | sortable="true" |
---|
254 | filterable="true" |
---|
255 | exportable="true" |
---|
256 | /> |
---|
257 | <tbl:columndef |
---|
258 | id="defaultUnit" |
---|
259 | property="defaultUnit.name" |
---|
260 | datatype="string" |
---|
261 | title="Default unit" |
---|
262 | sortable="true" |
---|
263 | filterable="true" |
---|
264 | exportable="true" |
---|
265 | /> |
---|
266 | <tbl:columndef |
---|
267 | id="isIdentifier" |
---|
268 | property="identifier" |
---|
269 | datatype="boolean" |
---|
270 | title="Is identifier" |
---|
271 | sortable="true" |
---|
272 | filterable="true" |
---|
273 | exportable="true" |
---|
274 | /> |
---|
275 | <tbl:columndef |
---|
276 | id="requiredForMiame" |
---|
277 | property="requiredForMiame" |
---|
278 | datatype="boolean" |
---|
279 | title="Required for MIAME" |
---|
280 | sortable="true" |
---|
281 | filterable="true" |
---|
282 | exportable="true" |
---|
283 | /> |
---|
284 | <tbl:columndef |
---|
285 | id="disableLogOfValues" |
---|
286 | property="disableLogOfValues" |
---|
287 | datatype="boolean" |
---|
288 | title="Disable history log" |
---|
289 | sortable="true" |
---|
290 | filterable="true" |
---|
291 | exportable="true" |
---|
292 | /> |
---|
293 | <tbl:columndef |
---|
294 | id="disableInheritance" |
---|
295 | property="disableInheritance" |
---|
296 | datatype="boolean" |
---|
297 | title="Disable inheritance" |
---|
298 | sortable="true" |
---|
299 | filterable="true" |
---|
300 | exportable="true" |
---|
301 | /> |
---|
302 | <tbl:columndef |
---|
303 | id="projectAnnotations" |
---|
304 | property="projectAnnotations" |
---|
305 | datatype="boolean" |
---|
306 | title="Project annotations" |
---|
307 | sortable="true" |
---|
308 | filterable="true" |
---|
309 | exportable="true" |
---|
310 | /> |
---|
311 | <tbl:columndef |
---|
312 | id="isEnumeration" |
---|
313 | property="enumeration" |
---|
314 | datatype="boolean" |
---|
315 | title="Enumeration" |
---|
316 | sortable="true" |
---|
317 | filterable="true" |
---|
318 | exportable="true" |
---|
319 | /> |
---|
320 | <tbl:columndef |
---|
321 | id="isProtocolParameter" |
---|
322 | property="protocolParameter" |
---|
323 | datatype="boolean" |
---|
324 | title="Protocol parameter" |
---|
325 | sortable="true" |
---|
326 | filterable="true" |
---|
327 | exportable="true" |
---|
328 | /> |
---|
329 | <tbl:columndef |
---|
330 | id="multiplicity" |
---|
331 | property="multiplicity" |
---|
332 | datatype="int" |
---|
333 | title="Multiplicity" |
---|
334 | sortable="true" |
---|
335 | filterable="true" |
---|
336 | exportable="true" |
---|
337 | /> |
---|
338 | <tbl:columndef |
---|
339 | id="defaultValue" |
---|
340 | property="defaultValue" |
---|
341 | datatype="string" |
---|
342 | title="Default value" |
---|
343 | sortable="true" |
---|
344 | filterable="true" |
---|
345 | exportable="true" |
---|
346 | /> |
---|
347 | <tbl:columndef |
---|
348 | id="minValue" |
---|
349 | property="@options('minValue')" |
---|
350 | datatype="string" |
---|
351 | title="Min value" |
---|
352 | exportable="true" |
---|
353 | filterable="true" |
---|
354 | /> |
---|
355 | <tbl:columndef |
---|
356 | id="maxValue" |
---|
357 | property="@options('maxValue')" |
---|
358 | datatype="string" |
---|
359 | title="Max value" |
---|
360 | exportable="true" |
---|
361 | filterable="true" |
---|
362 | /> |
---|
363 | <tbl:columndef |
---|
364 | id="itemTypes" |
---|
365 | property="@itemTypes" |
---|
366 | datatype="int" |
---|
367 | enumeration="<%=items%>" |
---|
368 | title="Item types" |
---|
369 | sortable="false" |
---|
370 | filterable="true" |
---|
371 | exportable="true" |
---|
372 | /> |
---|
373 | <tbl:columndef |
---|
374 | id="categories" |
---|
375 | title="Categories" |
---|
376 | property="&categories(name)" |
---|
377 | datatype="string" |
---|
378 | filterable="true" |
---|
379 | exportable="true" |
---|
380 | /> |
---|
381 | <tbl:columndef |
---|
382 | id="owner" |
---|
383 | property="owner.name" |
---|
384 | datatype="string" |
---|
385 | title="Owner" |
---|
386 | sortable="true" |
---|
387 | filterable="true" |
---|
388 | exportable="true" |
---|
389 | /> |
---|
390 | <tbl:columndef |
---|
391 | id="description" |
---|
392 | property="description" |
---|
393 | datatype="string" |
---|
394 | title="Description" |
---|
395 | sortable="true" |
---|
396 | filterable="true" |
---|
397 | exportable="true" |
---|
398 | /> |
---|
399 | <tbl:columndef |
---|
400 | id="permission" |
---|
401 | title="Permission" |
---|
402 | /> |
---|
403 | <tbl:columndef |
---|
404 | id="sharedTo" |
---|
405 | title="Shared to" |
---|
406 | filterable="true" |
---|
407 | filterproperty="!sharedTo.name" |
---|
408 | datatype="string" |
---|
409 | /> |
---|
410 | <tbl:columndef |
---|
411 | id="xt-columns" |
---|
412 | extensions="<%=columnsInvoker%>" |
---|
413 | jspcontext="<%=jspContext%>" |
---|
414 | /> |
---|
415 | <div class="panelgroup bg-filled-50 bottomborder"> |
---|
416 | <tbl:toolbar |
---|
417 | subclass="bottomborder" |
---|
418 | visible="<%=mode.hasToolbar()%>" |
---|
419 | > |
---|
420 | <tbl:button |
---|
421 | id="btnNewItem" |
---|
422 | subclass="auto-init" |
---|
423 | data-auto-init="menu-anchor" |
---|
424 | data-menu-id="mnuNewAnnotationType" |
---|
425 | disabled="<%=!createPermission%>" |
---|
426 | image="new.png" |
---|
427 | title="New…" |
---|
428 | tooltip="<%=createPermission ? "Create new annotation type" : "You do not have permission to create annotation types"%>" |
---|
429 | /> |
---|
430 | <tbl:button |
---|
431 | id="btnDeleteItems" |
---|
432 | image="delete.png" |
---|
433 | title="Delete" |
---|
434 | tooltip="Delete the selected items" |
---|
435 | /> |
---|
436 | <tbl:button |
---|
437 | id="btnRestoreItems" |
---|
438 | image="restore.png" |
---|
439 | title="Restore" |
---|
440 | tooltip="Restore the selected (deleted) items" |
---|
441 | /> |
---|
442 | <tbl:button |
---|
443 | id="btnShareItems" |
---|
444 | image="share.png" |
---|
445 | title="Share…" |
---|
446 | tooltip="Share the selected items" |
---|
447 | /> |
---|
448 | <tbl:button |
---|
449 | id="btnSetOwner" |
---|
450 | image="take_ownership.png" |
---|
451 | title="Set owner…" |
---|
452 | tooltip="Change owner of the selected items" |
---|
453 | /> |
---|
454 | <tbl:button |
---|
455 | id="btnColumns" |
---|
456 | image="columns.png" |
---|
457 | title="Columns…" |
---|
458 | tooltip="Show, hide and re-order columns" |
---|
459 | /> |
---|
460 | <tbl:button |
---|
461 | id="btnImport" |
---|
462 | data-plugin-type="IMPORT" |
---|
463 | image="import.png" |
---|
464 | title="Import…" |
---|
465 | tooltip="Import data" |
---|
466 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
467 | /> |
---|
468 | <tbl:button |
---|
469 | id="btnExport" |
---|
470 | data-plugin-type="EXPORT" |
---|
471 | image="export.png" |
---|
472 | title="Export…" |
---|
473 | tooltip="Export data" |
---|
474 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
475 | /> |
---|
476 | <tbl:button |
---|
477 | id="btnRunPlugin" |
---|
478 | data-plugin-type="OTHER" |
---|
479 | image="runplugin.png" |
---|
480 | title="Run plugin…" |
---|
481 | tooltip="Run a plugin" |
---|
482 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
483 | /> |
---|
484 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
485 | wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/> |
---|
486 | </tbl:toolbar> |
---|
487 | <tbl:panel> |
---|
488 | <tbl:presetselector /> |
---|
489 | <tbl:navigator |
---|
490 | page="<%=cc.getPage()%>" |
---|
491 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
492 | totalrows="<%=annotationTypes == null ? 0 : annotationTypes.getTotalCount()%>" |
---|
493 | visible="<%=mode.hasNavigator()%>" |
---|
494 | /> |
---|
495 | </tbl:panel> |
---|
496 | </div> |
---|
497 | <tbl:data> |
---|
498 | <tbl:headers> |
---|
499 | <tbl:headerrow> |
---|
500 | <tbl:header colspan="3" /> |
---|
501 | <tbl:columnheaders /> |
---|
502 | </tbl:headerrow> |
---|
503 | <% |
---|
504 | int numFilters = cc.getNumPropertyFilters(); |
---|
505 | int numRows = cc.getFilterRows(); |
---|
506 | for (int filterNo = 0; filterNo < numRows; filterNo++) |
---|
507 | { |
---|
508 | boolean lastRow = filterNo == numRows-1; |
---|
509 | %> |
---|
510 | <tbl:headerrow> |
---|
511 | <tbl:header subclass="index" /> |
---|
512 | <tbl:header |
---|
513 | subclass="check" |
---|
514 | visible="<%=mode.hasCheck()%>" |
---|
515 | ><base:icon |
---|
516 | subclass="link table-check" |
---|
517 | image="check_uncheck.png" |
---|
518 | tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" |
---|
519 | visible="<%=lastRow%>" |
---|
520 | /></tbl:header> |
---|
521 | <tbl:header |
---|
522 | subclass="check" |
---|
523 | visible="<%=mode.hasRadio()%>" |
---|
524 | /> |
---|
525 | <tbl:header |
---|
526 | subclass="icons" |
---|
527 | visible="<%=mode.hasIcons()%>" |
---|
528 | > |
---|
529 | <base:icon |
---|
530 | subclass="link table-filter-row-action" |
---|
531 | image="add.png" |
---|
532 | tooltip="Add extra filter row" |
---|
533 | visible="<%=lastRow%>" |
---|
534 | /><base:icon |
---|
535 | subclass="link table-filter-row-action" |
---|
536 | image="remove.png" |
---|
537 | tooltip="Remove this filter row" |
---|
538 | visible="<%=numRows > 1 || numFilters > 0 %>" |
---|
539 | data-remove-row="<%=filterNo%>" |
---|
540 | /> |
---|
541 | </tbl:header> |
---|
542 | <tbl:propertyfilter row="<%=filterNo%>" /> |
---|
543 | </tbl:headerrow> |
---|
544 | <% |
---|
545 | } |
---|
546 | %> |
---|
547 | <tbl:columnsubtitles /> |
---|
548 | </tbl:headers> |
---|
549 | <tbl:rows> |
---|
550 | <% |
---|
551 | if (cc.getMessage() != null) |
---|
552 | { |
---|
553 | %> |
---|
554 | <tbl:panel subclass="bg-filled-50"> |
---|
555 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
556 | </tbl:panel> |
---|
557 | <% |
---|
558 | cc.setMessage(null); |
---|
559 | } |
---|
560 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
561 | int selectedItemId = cc.getId(); |
---|
562 | |
---|
563 | if (annotationTypes != null) |
---|
564 | { |
---|
565 | while (annotationTypes.hasNext()) |
---|
566 | { |
---|
567 | AnnotationType item = annotationTypes.next(); |
---|
568 | int itemId = item.getId(); |
---|
569 | |
---|
570 | |
---|
571 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
572 | boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); |
---|
573 | boolean writePermission = item.hasPermission(Permission.WRITE); |
---|
574 | String name = HTML.encodeTags(item.getName()); |
---|
575 | String tooltip = mode.isSelectionMode() ? |
---|
576 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
577 | index++; |
---|
578 | numListed++; |
---|
579 | Set<Item> itemTypes = item.getEnabledItems(); |
---|
580 | %> |
---|
581 | <tbl:row> |
---|
582 | <tbl:header |
---|
583 | clazz="index" |
---|
584 | ><%=index%></tbl:header> |
---|
585 | <tbl:header |
---|
586 | clazz="check" |
---|
587 | visible="<%=mode.hasCheck()%>" |
---|
588 | ><input |
---|
589 | type="checkbox" |
---|
590 | name="<%=itemId%>" |
---|
591 | value="<%=itemId%>" |
---|
592 | title="<%=name%>" |
---|
593 | <%=cc.getSelected().contains(itemId) ? "checked" : ""%> |
---|
594 | ></tbl:header> |
---|
595 | <tbl:header |
---|
596 | clazz="check" |
---|
597 | visible="<%=mode.hasRadio()%>" |
---|
598 | ><input |
---|
599 | type="radio" |
---|
600 | name="item_id" |
---|
601 | value="<%=itemId%>" |
---|
602 | title="<%=name%>" |
---|
603 | <%=selectedItemId == itemId ? "checked" : ""%> |
---|
604 | ></tbl:header> |
---|
605 | <tbl:header |
---|
606 | clazz="icons" |
---|
607 | visible="<%=mode.hasIcons()%>" |
---|
608 | ><base:icon |
---|
609 | image="deleted.png" |
---|
610 | id="<%="delete."+itemId %>" |
---|
611 | subclass="<%=deletePermission ? "table-delete-item" : "disabled" %>" |
---|
612 | data-item-id="<%=itemId%>" |
---|
613 | tooltip="This item has been scheduled for deletion" |
---|
614 | visible="<%=item.isRemoved()%>" |
---|
615 | /><base:icon |
---|
616 | image="shared.png" |
---|
617 | id="<%="share."+itemId %>" |
---|
618 | subclass="<%=sharePermission ? "table-share-item" : "disabled" %>" |
---|
619 | data-item-id="<%=itemId%>" |
---|
620 | tooltip="This item is shared to other users, groups and/or projects" |
---|
621 | visible="<%=item.isShared()%>" |
---|
622 | /> </tbl:header> |
---|
623 | <tbl:cell column="name"><div |
---|
624 | class="link table-item" |
---|
625 | data-item-id="<%=itemId%>" |
---|
626 | data-no-edit="<%=writePermission ? 0 : 1 %>" |
---|
627 | tabindex="0" |
---|
628 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
629 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
630 | <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" /> |
---|
631 | <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell> |
---|
632 | <tbl:cell column="valueType"><%=item.getValueType()%></tbl:cell> |
---|
633 | <tbl:cell column="quantity"><base:propertyvalue |
---|
634 | item="<%=item%>" |
---|
635 | property="quantity" |
---|
636 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
637 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
638 | /></tbl:cell> |
---|
639 | <tbl:cell column="defaultUnit"><base:propertyvalue |
---|
640 | item="<%=item%>" |
---|
641 | property="defaultUnit" |
---|
642 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
643 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
644 | /></tbl:cell> |
---|
645 | <tbl:cell column="isEnumeration"><%=item.isEnumeration() ? |
---|
646 | HTML.encodeTags(Values.getString(item.getValues(), ", ", true, FormatterFactory.getTypeFormatter(sc, item.getValueType()) )) : |
---|
647 | "<i>- no -</i>"%></tbl:cell> |
---|
648 | <tbl:cell column="isIdentifier"><%=item.isIdentifier() ? "yes" : "no"%></tbl:cell> |
---|
649 | <tbl:cell column="requiredForMiame"><%=item.isRequiredForMiame() ? "yes" : "no"%></tbl:cell> |
---|
650 | <tbl:cell column="isProtocolParameter"><%=item.isProtocolParameter() ? "yes" : "no"%></tbl:cell> |
---|
651 | <tbl:cell column="disableLogOfValues"><%=item.getDisableLogOfValues() ? "yes" : "no"%></tbl:cell> |
---|
652 | <tbl:cell column="disableInheritance"><%=item.getDisableInheritance() ? "yes" : "no"%></tbl:cell> |
---|
653 | <tbl:cell column="projectAnnotations"><%=item.getProjectAnnotations() ? "yes" : "no"%></tbl:cell> |
---|
654 | <tbl:cell column="multiplicity"><%=item.getMultiplicity() == 0 ? "<i>- unlimited -</i>" : item.getMultiplicity()%></tbl:cell> |
---|
655 | <tbl:cell column="defaultValue"><%=HTML.encodeTags(item.getDefaultValue())%></tbl:cell> |
---|
656 | <tbl:cell column="minValue"><%=HTML.encodeTags(item.getOption("minValue"))%></tbl:cell> |
---|
657 | <tbl:cell column="maxValue"><%=HTML.encodeTags(item.getOption("maxValue"))%></tbl:cell> |
---|
658 | <tbl:cell column="itemTypes"><%=itemTypes.isEmpty() ? "<i>- none -</i>" : Values.getString(itemTypes, ", ", true)%></tbl:cell> |
---|
659 | <tbl:cell column="owner" |
---|
660 | ><base:propertyvalue |
---|
661 | item="<%=item%>" |
---|
662 | property="owner" |
---|
663 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
664 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
665 | /></tbl:cell> |
---|
666 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
667 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
668 | <tbl:cell column="categories"> |
---|
669 | <% |
---|
670 | categoryQuery.setParameter("annotationType", itemId, Type.INT); |
---|
671 | try |
---|
672 | { |
---|
673 | String separator = ""; |
---|
674 | for (AnnotationTypeCategory c : categoryQuery.list(dc)) |
---|
675 | { |
---|
676 | out.write(separator); |
---|
677 | if (mode.hasPropertyLink()) |
---|
678 | { |
---|
679 | out.write(Base.getLinkedName(ID, c, false, mode.hasEditLink())); |
---|
680 | } |
---|
681 | else |
---|
682 | { |
---|
683 | out.write(HTML.encodeTags(c.getName())); |
---|
684 | } |
---|
685 | separator = ", "; |
---|
686 | } |
---|
687 | } |
---|
688 | catch (Throwable t) |
---|
689 | { |
---|
690 | %> |
---|
691 | <div class="error"><%=t.getMessage()%></div> |
---|
692 | <% |
---|
693 | } |
---|
694 | %> |
---|
695 | </tbl:cell> |
---|
696 | <tbl:cell column="sharedTo"> |
---|
697 | <% |
---|
698 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
699 | while(sharees.hasNext()) |
---|
700 | { |
---|
701 | Nameable n = sharees.next(); |
---|
702 | if (mode.hasPropertyLink()) |
---|
703 | { |
---|
704 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
705 | } |
---|
706 | else |
---|
707 | { |
---|
708 | out.write(HTML.encodeTags(n.getName())); |
---|
709 | } |
---|
710 | out.write(sharees.hasNext() ? ", " : ""); |
---|
711 | } |
---|
712 | %> |
---|
713 | </tbl:cell> |
---|
714 | <tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> |
---|
715 | <tbl:cell column="xt-columns" /> |
---|
716 | </tbl:xt-cells> |
---|
717 | </tbl:row> |
---|
718 | <% |
---|
719 | } |
---|
720 | } |
---|
721 | if (numListed == 0) |
---|
722 | { |
---|
723 | %> |
---|
724 | <tbl:panel subclass="bg-filled-50"> |
---|
725 | <div class="messagecontainer note"> |
---|
726 | <%=annotationTypes == null || annotationTypes.getTotalCount() == 0 ? "No annotation types were found" : "No annotation types on this page. Please select another page!" %> |
---|
727 | </div> |
---|
728 | </tbl:panel> |
---|
729 | <% |
---|
730 | } |
---|
731 | %> |
---|
732 | </tbl:rows> |
---|
733 | </tbl:data> |
---|
734 | </tbl:table> |
---|
735 | </div> |
---|
736 | |
---|
737 | <base:buttongroup subclass="dialogbuttons"> |
---|
738 | <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
739 | <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
740 | <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
741 | </base:buttongroup> |
---|
742 | |
---|
743 | </base:body> |
---|
744 | </base:page> |
---|
745 | <% |
---|
746 | } |
---|
747 | finally |
---|
748 | { |
---|
749 | if (annotationTypes != null) annotationTypes.close(); |
---|
750 | if (dc != null) dc.close(); |
---|
751 | } |
---|
752 | %> |
---|