1 | <%-- $Id: list_annotationtypes.jsp 7943 2021-05-04 12:23:19Z 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 | stickyheaders="name" |
---|
179 | > |
---|
180 | <tbl:hidden |
---|
181 | name="mode" |
---|
182 | value="<%=mode.getName()%>" |
---|
183 | /> |
---|
184 | <tbl:hidden |
---|
185 | name="callback" |
---|
186 | value="<%=callback%>" |
---|
187 | skip="<%=callback == null%>" |
---|
188 | /> |
---|
189 | <tbl:columndef |
---|
190 | id="name" |
---|
191 | property="name" |
---|
192 | datatype="string" |
---|
193 | title="Name" |
---|
194 | sortable="true" |
---|
195 | filterable="true" |
---|
196 | exportable="true" |
---|
197 | show="always" |
---|
198 | /> |
---|
199 | <tbl:columndef |
---|
200 | id="id" |
---|
201 | clazz="uniquecol" |
---|
202 | property="id" |
---|
203 | datatype="int" |
---|
204 | title="ID" |
---|
205 | sortable="true" |
---|
206 | filterable="true" |
---|
207 | exportable="true" |
---|
208 | /> |
---|
209 | <tbl:columndef |
---|
210 | id="entryDate" |
---|
211 | property="entryDate" |
---|
212 | datatype="date" |
---|
213 | title="Registered" |
---|
214 | sortable="true" |
---|
215 | filterable="true" |
---|
216 | exportable="true" |
---|
217 | formatter="<%=dateFormatter%>" |
---|
218 | /> |
---|
219 | <tbl:columndef |
---|
220 | id="externalId" |
---|
221 | property="externalId" |
---|
222 | datatype="string" |
---|
223 | title="External id" |
---|
224 | sortable="true" |
---|
225 | filterable="true" |
---|
226 | exportable="true" |
---|
227 | /> |
---|
228 | <tbl:columndef |
---|
229 | id="valueType" |
---|
230 | property="valueType" |
---|
231 | datatype="int" |
---|
232 | enumeration="<%=types%>" |
---|
233 | title="Value type" |
---|
234 | sortable="true" |
---|
235 | filterable="true" |
---|
236 | exportable="true" |
---|
237 | /> |
---|
238 | <% |
---|
239 | Enumeration<String, String> quantities = new Enumeration<String, String>(); |
---|
240 | quantities.add("", "- none -"); |
---|
241 | for (Quantity q : quantityQuery.list(dc)) |
---|
242 | { |
---|
243 | quantities.add(Integer.toString(q.getId()), q.getName()); |
---|
244 | } |
---|
245 | %> |
---|
246 | <tbl:columndef |
---|
247 | id="quantity" |
---|
248 | property="quantity" |
---|
249 | sortproperty="quantity.name" |
---|
250 | exportproperty="quantity.name:string" |
---|
251 | datatype="int" |
---|
252 | enumeration="<%=quantities%>" |
---|
253 | title="Quantity" |
---|
254 | sortable="true" |
---|
255 | filterable="true" |
---|
256 | exportable="true" |
---|
257 | /> |
---|
258 | <tbl:columndef |
---|
259 | id="defaultUnit" |
---|
260 | property="defaultUnit.name" |
---|
261 | datatype="string" |
---|
262 | title="Default unit" |
---|
263 | sortable="true" |
---|
264 | filterable="true" |
---|
265 | exportable="true" |
---|
266 | /> |
---|
267 | <tbl:columndef |
---|
268 | id="isIdentifier" |
---|
269 | property="identifier" |
---|
270 | datatype="boolean" |
---|
271 | title="Is identifier" |
---|
272 | sortable="true" |
---|
273 | filterable="true" |
---|
274 | exportable="true" |
---|
275 | /> |
---|
276 | <tbl:columndef |
---|
277 | id="requiredForMiame" |
---|
278 | property="requiredForMiame" |
---|
279 | datatype="boolean" |
---|
280 | title="Required for MIAME" |
---|
281 | sortable="true" |
---|
282 | filterable="true" |
---|
283 | exportable="true" |
---|
284 | /> |
---|
285 | <tbl:columndef |
---|
286 | id="disableLogOfValues" |
---|
287 | property="disableLogOfValues" |
---|
288 | datatype="boolean" |
---|
289 | title="Disable history log" |
---|
290 | sortable="true" |
---|
291 | filterable="true" |
---|
292 | exportable="true" |
---|
293 | /> |
---|
294 | <tbl:columndef |
---|
295 | id="disableInheritance" |
---|
296 | property="disableInheritance" |
---|
297 | datatype="boolean" |
---|
298 | title="Disable inheritance" |
---|
299 | sortable="true" |
---|
300 | filterable="true" |
---|
301 | exportable="true" |
---|
302 | /> |
---|
303 | <tbl:columndef |
---|
304 | id="projectAnnotations" |
---|
305 | property="projectAnnotations" |
---|
306 | datatype="boolean" |
---|
307 | title="Project annotations" |
---|
308 | sortable="true" |
---|
309 | filterable="true" |
---|
310 | exportable="true" |
---|
311 | /> |
---|
312 | <tbl:columndef |
---|
313 | id="isEnumeration" |
---|
314 | property="enumeration" |
---|
315 | datatype="boolean" |
---|
316 | title="Enumeration" |
---|
317 | sortable="true" |
---|
318 | filterable="true" |
---|
319 | exportable="true" |
---|
320 | /> |
---|
321 | <tbl:columndef |
---|
322 | id="isProtocolParameter" |
---|
323 | property="protocolParameter" |
---|
324 | datatype="boolean" |
---|
325 | title="Protocol parameter" |
---|
326 | sortable="true" |
---|
327 | filterable="true" |
---|
328 | exportable="true" |
---|
329 | /> |
---|
330 | <tbl:columndef |
---|
331 | id="multiplicity" |
---|
332 | property="multiplicity" |
---|
333 | datatype="int" |
---|
334 | title="Multiplicity" |
---|
335 | sortable="true" |
---|
336 | filterable="true" |
---|
337 | exportable="true" |
---|
338 | /> |
---|
339 | <tbl:columndef |
---|
340 | id="defaultValue" |
---|
341 | property="defaultValue" |
---|
342 | datatype="string" |
---|
343 | title="Default value" |
---|
344 | sortable="true" |
---|
345 | filterable="true" |
---|
346 | exportable="true" |
---|
347 | /> |
---|
348 | <tbl:columndef |
---|
349 | id="minValue" |
---|
350 | property="@options('minValue')" |
---|
351 | datatype="string" |
---|
352 | title="Min value" |
---|
353 | exportable="true" |
---|
354 | filterable="true" |
---|
355 | /> |
---|
356 | <tbl:columndef |
---|
357 | id="maxValue" |
---|
358 | property="@options('maxValue')" |
---|
359 | datatype="string" |
---|
360 | title="Max value" |
---|
361 | exportable="true" |
---|
362 | filterable="true" |
---|
363 | /> |
---|
364 | <tbl:columndef |
---|
365 | id="itemTypes" |
---|
366 | property="@itemTypes" |
---|
367 | datatype="int" |
---|
368 | enumeration="<%=items%>" |
---|
369 | title="Item types" |
---|
370 | sortable="false" |
---|
371 | filterable="true" |
---|
372 | exportable="true" |
---|
373 | /> |
---|
374 | <tbl:columndef |
---|
375 | id="categories" |
---|
376 | title="Categories" |
---|
377 | property="&categories(name)" |
---|
378 | datatype="string" |
---|
379 | filterable="true" |
---|
380 | exportable="true" |
---|
381 | /> |
---|
382 | <tbl:columndef |
---|
383 | id="owner" |
---|
384 | property="owner.name" |
---|
385 | datatype="string" |
---|
386 | title="Owner" |
---|
387 | sortable="true" |
---|
388 | filterable="true" |
---|
389 | exportable="true" |
---|
390 | /> |
---|
391 | <tbl:columndef |
---|
392 | id="description" |
---|
393 | property="description" |
---|
394 | datatype="string" |
---|
395 | title="Description" |
---|
396 | sortable="true" |
---|
397 | filterable="true" |
---|
398 | exportable="true" |
---|
399 | /> |
---|
400 | <tbl:columndef |
---|
401 | id="permission" |
---|
402 | title="Permission" |
---|
403 | /> |
---|
404 | <tbl:columndef |
---|
405 | id="sharedTo" |
---|
406 | title="Shared to" |
---|
407 | filterable="true" |
---|
408 | filterproperty="!sharedTo.name" |
---|
409 | datatype="string" |
---|
410 | /> |
---|
411 | <tbl:columndef |
---|
412 | id="xt-columns" |
---|
413 | extensions="<%=columnsInvoker%>" |
---|
414 | jspcontext="<%=jspContext%>" |
---|
415 | /> |
---|
416 | <div class="panelgroup bg-filled-50 bottomborder"> |
---|
417 | <tbl:toolbar |
---|
418 | subclass="bottomborder" |
---|
419 | visible="<%=mode.hasToolbar()%>" |
---|
420 | > |
---|
421 | <tbl:button |
---|
422 | id="btnNewItem" |
---|
423 | subclass="auto-init" |
---|
424 | data-auto-init="menu-anchor" |
---|
425 | data-menu-id="mnuNewAnnotationType" |
---|
426 | disabled="<%=!createPermission%>" |
---|
427 | image="new.png" |
---|
428 | title="New…" |
---|
429 | tooltip="<%=createPermission ? "Create new annotation type" : "You do not have permission to create annotation types"%>" |
---|
430 | /> |
---|
431 | <tbl:button |
---|
432 | id="btnDeleteItems" |
---|
433 | image="delete.png" |
---|
434 | title="Delete" |
---|
435 | tooltip="Delete the selected items" |
---|
436 | /> |
---|
437 | <tbl:button |
---|
438 | id="btnRestoreItems" |
---|
439 | image="restore.png" |
---|
440 | title="Restore" |
---|
441 | tooltip="Restore the selected (deleted) items" |
---|
442 | /> |
---|
443 | <tbl:button |
---|
444 | id="btnShareItems" |
---|
445 | image="share.png" |
---|
446 | title="Share…" |
---|
447 | tooltip="Share the selected items" |
---|
448 | /> |
---|
449 | <tbl:button |
---|
450 | id="btnSetOwner" |
---|
451 | image="take_ownership.png" |
---|
452 | title="Set owner…" |
---|
453 | tooltip="Change owner of the selected items" |
---|
454 | /> |
---|
455 | <tbl:button |
---|
456 | id="btnColumns" |
---|
457 | image="columns.png" |
---|
458 | title="Columns…" |
---|
459 | tooltip="Show, hide and re-order columns" |
---|
460 | /> |
---|
461 | <tbl:button |
---|
462 | id="btnImport" |
---|
463 | data-plugin-type="IMPORT" |
---|
464 | image="import.png" |
---|
465 | title="Import…" |
---|
466 | tooltip="Import data" |
---|
467 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
468 | /> |
---|
469 | <tbl:button |
---|
470 | id="btnExport" |
---|
471 | data-plugin-type="EXPORT" |
---|
472 | image="export.png" |
---|
473 | title="Export…" |
---|
474 | tooltip="Export data" |
---|
475 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
476 | /> |
---|
477 | <tbl:button |
---|
478 | id="btnRunPlugin" |
---|
479 | data-plugin-type="OTHER" |
---|
480 | image="runplugin.png" |
---|
481 | title="Run plugin…" |
---|
482 | tooltip="Run a plugin" |
---|
483 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
484 | /> |
---|
485 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
486 | wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/> |
---|
487 | </tbl:toolbar> |
---|
488 | <tbl:panel> |
---|
489 | <tbl:presetselector /> |
---|
490 | <tbl:navigator |
---|
491 | page="<%=cc.getPage()%>" |
---|
492 | rowsperpage="<%=cc.getRowsPerPage()%>" |
---|
493 | totalrows="<%=annotationTypes == null ? 0 : annotationTypes.getTotalCount()%>" |
---|
494 | visible="<%=mode.hasNavigator()%>" |
---|
495 | /> |
---|
496 | </tbl:panel> |
---|
497 | </div> |
---|
498 | <tbl:data> |
---|
499 | <tbl:headers> |
---|
500 | <tbl:headerrow> |
---|
501 | <tbl:header clazz="row-index bg-filled-100" /> |
---|
502 | <tbl:columnheaders /> |
---|
503 | </tbl:headerrow> |
---|
504 | <% |
---|
505 | int numFilters = cc.getNumPropertyFilters(); |
---|
506 | int numRows = cc.getFilterRows(); |
---|
507 | for (int filterNo = 0; filterNo < numRows; filterNo++) |
---|
508 | { |
---|
509 | boolean lastRow = filterNo == numRows-1; |
---|
510 | %> |
---|
511 | <tbl:headerrow> |
---|
512 | <tbl:header subclass="row-index bg-filled-100"> |
---|
513 | <div class="index-<%=mode.getName()%>"> |
---|
514 | <div class="index"></div> |
---|
515 | <div class="check"> |
---|
516 | <base:icon |
---|
517 | subclass="link table-check" |
---|
518 | image="check_uncheck.png" |
---|
519 | tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" |
---|
520 | visible="<%=lastRow && mode.hasCheck()%>" |
---|
521 | /> |
---|
522 | </div> |
---|
523 | <div class="icons"> |
---|
524 | <base:icon |
---|
525 | subclass="link table-filter-row-action" |
---|
526 | image="add.png" |
---|
527 | tooltip="Add extra filter row" |
---|
528 | visible="<%=lastRow%>" |
---|
529 | /><base:icon |
---|
530 | subclass="link table-filter-row-action" |
---|
531 | image="remove.png" |
---|
532 | tooltip="Remove this filter row" |
---|
533 | visible="<%=numRows > 1 || numFilters > 0 %>" |
---|
534 | data-remove-row="<%=filterNo%>" |
---|
535 | /> |
---|
536 | </div> |
---|
537 | </div> |
---|
538 | </tbl:header> |
---|
539 | <tbl:propertyfilter row="<%=filterNo%>" /> |
---|
540 | </tbl:headerrow> |
---|
541 | <% |
---|
542 | } |
---|
543 | %> |
---|
544 | <tbl:columnsubtitles /> |
---|
545 | </tbl:headers> |
---|
546 | <tbl:rows> |
---|
547 | <% |
---|
548 | if (cc.getMessage() != null) |
---|
549 | { |
---|
550 | %> |
---|
551 | <tbl:panel subclass="bg-filled-50"> |
---|
552 | <div class="messagecontainer error"><%=cc.getMessage()%></div> |
---|
553 | </tbl:panel> |
---|
554 | <% |
---|
555 | cc.setMessage(null); |
---|
556 | } |
---|
557 | int index = cc.getPage()*cc.getRowsPerPage(); |
---|
558 | int selectedItemId = cc.getId(); |
---|
559 | |
---|
560 | if (annotationTypes != null) |
---|
561 | { |
---|
562 | while (annotationTypes.hasNext()) |
---|
563 | { |
---|
564 | AnnotationType item = annotationTypes.next(); |
---|
565 | int itemId = item.getId(); |
---|
566 | |
---|
567 | |
---|
568 | boolean deletePermission = item.hasPermission(Permission.DELETE); |
---|
569 | boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION); |
---|
570 | boolean writePermission = item.hasPermission(Permission.WRITE); |
---|
571 | String name = HTML.encodeTags(item.getName()); |
---|
572 | String tooltip = mode.isSelectionMode() ? |
---|
573 | "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : ""); |
---|
574 | index++; |
---|
575 | numListed++; |
---|
576 | Set<Item> itemTypes = item.getEnabledItems(); |
---|
577 | %> |
---|
578 | <tbl:row> |
---|
579 | <tbl:header clazz="row-index bg-filled-100"> |
---|
580 | <div class="index-<%=mode.getName()%>"> |
---|
581 | <div class="index <%=index>999?"index-smaller":""%>"><%=index%></div> |
---|
582 | <div class="check"> |
---|
583 | <base:input |
---|
584 | type="checkbox" |
---|
585 | name="<%=itemId%>" |
---|
586 | value="<%=itemId%>" |
---|
587 | title="<%=name%>" |
---|
588 | checked="<%=cc.getSelected().contains(itemId)%>" |
---|
589 | visible="<%=mode.hasCheck()%>" |
---|
590 | /> |
---|
591 | <base:input |
---|
592 | type="radio" |
---|
593 | name="item_id" |
---|
594 | value="<%=itemId%>" |
---|
595 | title="<%=name%>" |
---|
596 | checked="<%=selectedItemId == itemId%>" |
---|
597 | visible="<%=mode.hasRadio()%>" |
---|
598 | /> |
---|
599 | </div> |
---|
600 | <div class="icons"> |
---|
601 | <base:icon |
---|
602 | image="deleted.png" |
---|
603 | id="<%="delete."+itemId %>" |
---|
604 | subclass="<%=deletePermission ? "table-delete-item" : "disabled" %>" |
---|
605 | data-item-id="<%=itemId%>" |
---|
606 | tooltip="This item has been scheduled for deletion" |
---|
607 | visible="<%=item.isRemoved()%>" |
---|
608 | /><base:icon |
---|
609 | image="shared.png" |
---|
610 | id="<%="share."+itemId %>" |
---|
611 | subclass="<%=sharePermission ? "table-share-item" : "disabled" %>" |
---|
612 | data-item-id="<%=itemId%>" |
---|
613 | tooltip="This item is shared to other users, groups and/or projects" |
---|
614 | visible="<%=item.isShared()%>" |
---|
615 | /> |
---|
616 | </div> |
---|
617 | </div> |
---|
618 | </tbl:header> |
---|
619 | <tbl:cell column="name"><div |
---|
620 | class="link table-item" |
---|
621 | data-item-id="<%=itemId%>" |
---|
622 | data-no-edit="<%=writePermission ? 0 : 1 %>" |
---|
623 | tabindex="0" |
---|
624 | title="<%=tooltip%>"><%=name%></div></tbl:cell> |
---|
625 | <tbl:cell column="id"><%=item.getId()%></tbl:cell> |
---|
626 | <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" /> |
---|
627 | <tbl:cell column="externalId"><%=HTML.encodeTags(item.getExternalId())%></tbl:cell> |
---|
628 | <tbl:cell column="valueType"><%=item.getValueType()%></tbl:cell> |
---|
629 | <tbl:cell column="quantity"><base:propertyvalue |
---|
630 | item="<%=item%>" |
---|
631 | property="quantity" |
---|
632 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
633 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
634 | /></tbl:cell> |
---|
635 | <tbl:cell column="defaultUnit"><base:propertyvalue |
---|
636 | item="<%=item%>" |
---|
637 | property="defaultUnit" |
---|
638 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
639 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
640 | /></tbl:cell> |
---|
641 | <tbl:cell column="isEnumeration"><%=item.isEnumeration() ? |
---|
642 | HTML.encodeTags(Values.getString(item.getValues(), ", ", true, FormatterFactory.getTypeFormatter(sc, item.getValueType()) )) : |
---|
643 | "<i>- no -</i>"%></tbl:cell> |
---|
644 | <tbl:cell column="isIdentifier"><%=item.isIdentifier() ? "yes" : "no"%></tbl:cell> |
---|
645 | <tbl:cell column="requiredForMiame"><%=item.isRequiredForMiame() ? "yes" : "no"%></tbl:cell> |
---|
646 | <tbl:cell column="isProtocolParameter"><%=item.isProtocolParameter() ? "yes" : "no"%></tbl:cell> |
---|
647 | <tbl:cell column="disableLogOfValues"><%=item.getDisableLogOfValues() ? "yes" : "no"%></tbl:cell> |
---|
648 | <tbl:cell column="disableInheritance"><%=item.getDisableInheritance() ? "yes" : "no"%></tbl:cell> |
---|
649 | <tbl:cell column="projectAnnotations"><%=item.getProjectAnnotations() ? "yes" : "no"%></tbl:cell> |
---|
650 | <tbl:cell column="multiplicity"><%=item.getMultiplicity() == 0 ? "<i>- unlimited -</i>" : item.getMultiplicity()%></tbl:cell> |
---|
651 | <tbl:cell column="defaultValue"><%=HTML.encodeTags(item.getDefaultValue())%></tbl:cell> |
---|
652 | <tbl:cell column="minValue"><%=HTML.encodeTags(item.getOption("minValue"))%></tbl:cell> |
---|
653 | <tbl:cell column="maxValue"><%=HTML.encodeTags(item.getOption("maxValue"))%></tbl:cell> |
---|
654 | <tbl:cell column="itemTypes"><%=itemTypes.isEmpty() ? "<i>- none -</i>" : Values.getString(itemTypes, ", ", true)%></tbl:cell> |
---|
655 | <tbl:cell column="owner" |
---|
656 | ><base:propertyvalue |
---|
657 | item="<%=item%>" |
---|
658 | property="owner" |
---|
659 | enableEditLink="<%=mode.hasEditLink()%>" |
---|
660 | enablePropertyLink="<%=mode.hasPropertyLink()%>" |
---|
661 | /></tbl:cell> |
---|
662 | <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell> |
---|
663 | <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> |
---|
664 | <tbl:cell column="categories"> |
---|
665 | <% |
---|
666 | categoryQuery.setParameter("annotationType", itemId, Type.INT); |
---|
667 | try |
---|
668 | { |
---|
669 | String separator = ""; |
---|
670 | for (AnnotationTypeCategory c : categoryQuery.list(dc)) |
---|
671 | { |
---|
672 | out.write(separator); |
---|
673 | if (mode.hasPropertyLink()) |
---|
674 | { |
---|
675 | out.write(Base.getLinkedName(ID, c, false, mode.hasEditLink())); |
---|
676 | } |
---|
677 | else |
---|
678 | { |
---|
679 | out.write(HTML.encodeTags(c.getName())); |
---|
680 | } |
---|
681 | separator = ", "; |
---|
682 | } |
---|
683 | } |
---|
684 | catch (Throwable t) |
---|
685 | { |
---|
686 | %> |
---|
687 | <div class="error"><%=t.getMessage()%></div> |
---|
688 | <% |
---|
689 | } |
---|
690 | %> |
---|
691 | </tbl:cell> |
---|
692 | <tbl:cell column="sharedTo"> |
---|
693 | <% |
---|
694 | Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator(); |
---|
695 | while(sharees.hasNext()) |
---|
696 | { |
---|
697 | Nameable n = sharees.next(); |
---|
698 | if (mode.hasPropertyLink()) |
---|
699 | { |
---|
700 | out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink())); |
---|
701 | } |
---|
702 | else |
---|
703 | { |
---|
704 | out.write(HTML.encodeTags(n.getName())); |
---|
705 | } |
---|
706 | out.write(sharees.hasNext() ? ", " : ""); |
---|
707 | } |
---|
708 | %> |
---|
709 | </tbl:cell> |
---|
710 | <tbl:xt-cells dc="<%=dc%>" item="<%=item%>"> |
---|
711 | <tbl:cell column="xt-columns" /> |
---|
712 | </tbl:xt-cells> |
---|
713 | </tbl:row> |
---|
714 | <% |
---|
715 | } |
---|
716 | } |
---|
717 | if (numListed == 0) |
---|
718 | { |
---|
719 | %> |
---|
720 | <tbl:panel subclass="bg-filled-50"> |
---|
721 | <div class="messagecontainer note"> |
---|
722 | <%=annotationTypes == null || annotationTypes.getTotalCount() == 0 ? "No annotation types were found" : "No annotation types on this page. Please select another page!" %> |
---|
723 | </div> |
---|
724 | </tbl:panel> |
---|
725 | <% |
---|
726 | } |
---|
727 | %> |
---|
728 | </tbl:rows> |
---|
729 | </tbl:data> |
---|
730 | </tbl:table> |
---|
731 | </div> |
---|
732 | |
---|
733 | <base:buttongroup subclass="dialogbuttons"> |
---|
734 | <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" /> |
---|
735 | <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" /> |
---|
736 | <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" /> |
---|
737 | </base:buttongroup> |
---|
738 | |
---|
739 | </base:body> |
---|
740 | </base:page> |
---|
741 | <% |
---|
742 | } |
---|
743 | finally |
---|
744 | { |
---|
745 | if (annotationTypes != null) annotationTypes.close(); |
---|
746 | if (dc != null) dc.close(); |
---|
747 | } |
---|
748 | %> |
---|