source: trunk/www/views/physicalbioassays/list_bioassays.jsp @ 7813

Last change on this file since 7813 was 7813, checked in by Nicklas Nordborg, 3 years ago

Merge BASE 3.16.1 to the trunk.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 27.2 KB
Line 
1<%-- $Id: list_bioassays.jsp 7813 2020-05-19 12:24:30Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
4  Copyright (C) 2007 Johan Enell, 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.PhysicalBioAssay"
31  import="net.sf.basedb.core.Extract"
32  import="net.sf.basedb.core.Tag"
33  import="net.sf.basedb.core.DerivedBioAssay"
34  import="net.sf.basedb.core.BioMaterialEvent"
35  import="net.sf.basedb.core.BioMaterialEventSource"
36  import="net.sf.basedb.core.AnnotationType"
37  import="net.sf.basedb.core.AnnotationSet"
38  import="net.sf.basedb.core.Annotation"
39  import="net.sf.basedb.core.ItemSubtype"
40  import="net.sf.basedb.core.ItemQuery"
41  import="net.sf.basedb.core.Include"
42  import="net.sf.basedb.core.Type"
43  import="net.sf.basedb.core.ItemResultIterator"
44  import="net.sf.basedb.core.ItemResultList"
45  import="net.sf.basedb.core.ItemContext"
46  import="net.sf.basedb.core.ItemList"
47  import="net.sf.basedb.core.Nameable"
48  import="net.sf.basedb.core.Permission"
49  import="net.sf.basedb.core.PermissionDeniedException"
50  import="net.sf.basedb.core.PluginDefinition"
51  import="net.sf.basedb.core.query.Hql"
52  import="net.sf.basedb.core.query.Restrictions"
53  import="net.sf.basedb.core.query.Expressions"
54  import="net.sf.basedb.core.query.Orders"
55  import="net.sf.basedb.core.query.Hql"
56  import="net.sf.basedb.core.plugin.GuiContext"
57  import="net.sf.basedb.core.plugin.Plugin"
58  import="net.sf.basedb.core.snapshot.AnnotationLoaderUtil"
59  import="net.sf.basedb.core.snapshot.AnnotationTypeFilter"
60  import="net.sf.basedb.core.snapshot.AnnotationSnapshot"
61  import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot"
62  import="net.sf.basedb.core.snapshot.SnapshotManager"
63  import="net.sf.basedb.util.Enumeration"
64  import="net.sf.basedb.util.ShareableUtil"
65  import="net.sf.basedb.clients.web.Base"
66  import="net.sf.basedb.clients.web.ModeInfo"
67  import="net.sf.basedb.clients.web.PermissionUtil"
68  import="net.sf.basedb.clients.web.util.HTML"
69  import="net.sf.basedb.util.formatter.Formatter"
70  import="net.sf.basedb.util.formatter.NameableFormatter"
71  import="net.sf.basedb.clients.web.formatter.LinkedItemFormatter"
72  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
73  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
74  import="net.sf.basedb.clients.web.extensions.JspContext"
75  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
76  import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" 
77  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
78  import="net.sf.basedb.clients.web.extensions.list.ListColumnAction"
79  import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil"
80  import="net.sf.basedb.clients.web.util.ProjectSpecificInfoFilter"
81  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
82  import="net.sf.basedb.util.Values"
83  import="java.util.Iterator"
84  import="java.util.List"
85  import="java.util.Map"
86  import="java.util.Date"
87  import="java.util.ArrayList"
88%>
89<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
90<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
91<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
92<%!
93  private static final Item itemType = Item.PHYSICALBIOASSAY;
94  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST);
95%>
96<%
97final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType);
98final String ID = sc.getId();
99final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType);
100final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
101
102final ModeInfo mode = ModeInfo.get(request.getParameter("mode"));
103final Formatter<Nameable> nameableFormatter = mode.hasPropertyLink() ? new LinkedItemFormatter(mode.hasEditLink()) : new NameableFormatter();
104final String callback = request.getParameter("callback");
105final String title = mode.generateTitle("physical bioassay", "physical bioassays");
106final DbControl dc = sc.newDbControl();
107ItemResultIterator<PhysicalBioAssay> bioAssays = null;
108List<AnnotationLoaderUtil> annotationLoaders = new ArrayList<AnnotationLoaderUtil>();
109try
110{
111  ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType);
112  SnapshotManager manager = new SnapshotManager();
113  ProjectSpecificInfoFilter psInfo = new ProjectSpecificInfoFilter();
114  for (AnnotationType at : annotationTypeQuery.list(dc))
115  {
116    annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at));
117  }
118  annotationTypeQuery = Base.getInheritedAnnotationColumns(cc.getSetting("columns"));
119  for (AnnotationType at : annotationTypeQuery.list(dc))
120  {
121    annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at, false, true));
122  }
123  final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType);
124
125  // Query for extracts relatated to the current bioassay
126  final ItemQuery<Extract> extractQuery = Extract.getQuery();
127  extractQuery.setIncludes(cc.getInclude());
128  extractQuery.join(Hql.innerJoin("childCreationEvents", "cce"));
129  extractQuery.join(Hql.innerJoin("cce", "event", "evt"));
130  extractQuery.restrict(Restrictions.eq(Hql.property("evt", "physicalBioAssay"), Expressions.parameter("bioAssay")));
131  extractQuery.order(Orders.asc(Hql.property("cce", "position")));
132  extractQuery.order(Orders.asc(Hql.property("name"))); 
133
134  // Query for derived bioassay sets from to the current bioassay
135  final ItemQuery<DerivedBioAssay> dbasQuery = DerivedBioAssay.getQuery();
136  dbasQuery.setIncludes(cc.getInclude());
137  dbasQuery.join(Hql.innerJoin("physicalBioAssays", "pba"));
138  dbasQuery.restrict(Restrictions.eq(Hql.alias("pba"), Expressions.parameter("bioAssay")));
139  dbasQuery.restrict(Restrictions.eq(Hql.property("root"), Expressions.bool(true)));
140  dbasQuery.order(Orders.asc(Hql.property("name"))); 
141
142  // List membership
143  final ItemQuery<ItemList> listQuery = ItemList.getQuery();
144  listQuery.setIncludes(cc.getInclude());
145  listQuery.join(Hql.innerJoin("members", "m"));
146  listQuery.restrict(Restrictions.eq(Hql.property("memberType"), Expressions.integer(itemType.getValue())));
147  listQuery.restrict(Restrictions.eq(Hql.alias("m"), Expressions.parameter("itemId", Type.INT)));
148  listQuery.order(Orders.asc(Hql.property("name")));
149
150  final boolean createDerivedBioAssayPermission = sc.hasPermission(Permission.CREATE, Item.DERIVEDBIOASSAY); 
151 
152  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
153  try
154  {
155    final ItemQuery<PhysicalBioAssay> query = Base.getConfiguredQuery(dc, cc, true, PhysicalBioAssay.getQuery(), mode);
156    bioAssays = query.iterate(dc);
157  }
158  catch (Throwable t)
159  {
160    cc.setMessage(t.getMessage());
161    t.printStackTrace();
162  }
163  int numListed = 0;
164  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
165  Formatter<Number> numericFormatter = FormatterFactory.getNumberFormatter(sc);
166  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null);
167  ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext);
168  ExtensionsInvoker<ListColumnAction<PhysicalBioAssay,?>> columnsInvoker = ListColumnUtil.useExtensions(jspContext);
169  %>
170  <base:page title="<%=title==null ? "Physical bioassays" : title%>" type="<%=mode.getPageType()%>" id="list-page">
171  <base:head scripts="table.js,~bioassays.js" styles="table.css,toolbar.css">
172    <ext:scripts context="<%=jspContext%>" />
173    <ext:stylesheets context="<%=jspContext%>" />
174  </base:head>
175 
176  <base:body>
177    <h1><%=title==null ? "Physical bioassays" : title%></h1>
178    <div class="content">
179    <tbl:table 
180      id="bioassays" 
181      columns="<%=cc.getSetting("columns")%>"
182      sortby="<%=cc.getSortProperty()%>" 
183      direction="<%=cc.getSortDirection()%>"
184      action="index.jsp"
185      sc="<%=sc%>"
186      item="<%=itemType%>"
187      filterrows="<%=cc.getFilterRows()%>"
188      subclass="fulltable"
189      data-inherited-annotations="true"
190      data-parent-columns="true"
191      >
192      <tbl:hidden 
193        name="mode" 
194        value="<%=mode.getName()%>" 
195      />
196      <tbl:hidden 
197        name="callback" 
198        value="<%=callback%>" 
199        skip="<%=callback == null%>" 
200      />
201      <tbl:columndef 
202        id="name"
203        property="name"
204        datatype="string"
205        title="Name"
206        sortable="true" 
207        filterable="true"
208        exportable="true"
209        show="always" 
210      />
211      <tbl:columndef 
212        id="itemSubtype"
213        property="itemSubtype"
214        sortproperty="itemSubtype.name"
215        exportproperty="itemSubtype.name:string"
216        datatype="int"
217        enumeration="<%=Enumeration.fromItems(subtypesQuery.list(dc), "-none-")%>"
218        title="Type"
219        sortable="true" 
220        filterable="true"
221        exportable="true"
222      />
223      <tbl:columndef
224        id="id"
225        clazz="uniquecol"
226        property="id"
227        datatype="int"
228        title="ID"
229        sortable="true"
230        filterable="true"
231        exportable="true"
232      />
233      <tbl:columndef 
234        id="size"
235        property="size"
236        datatype="int"
237        title="Size"
238        sortable="true" 
239        filterable="true"
240        exportable="true"
241      />
242      <tbl:columndef
243        id="extracts"
244        title="Extracts"
245        property="&creationEvent.sources(bioMaterial.name)"
246        datatype="string"
247        filterable="true"
248        exportable="true"
249      />
250      <tbl:columndef 
251        id="arraySlide"
252        property="arraySlide.name"
253        datatype="string"
254        title="Array slide"
255        sortable="true" 
256        filterable="true"
257        exportable="true"
258      />
259      <tbl:columndef
260        id="derivedBioAssays"
261        title="Derived bioassays"
262        property="&rootDerivedBioAssays(%name)"
263        datatype="string"
264        filterable="true"
265        exportable="true"
266      />
267      <tbl:columndef 
268        id="protocol"
269        property="creationEvent.protocol.name"
270        datatype="string"
271        title="Protocol"
272        sortable="true" 
273        filterable="true"
274        exportable="true"
275      />
276      <tbl:columndef
277        id="hardware"
278        property="creationEvent.hardware.name"
279        datatype="string"
280        title="Hardware"
281        sortable="true"
282        filterable="true"
283        exportable="true"
284      />
285      <tbl:columndef 
286        id="kit"
287        property="creationEvent.kit.name"
288        datatype="string"
289        title="Kit"
290        sortable="true" 
291        filterable="true"
292        exportable="true"
293      />
294      <tbl:columndef 
295        id="eventDate"
296        property="creationEvent.eventDate"
297        datatype="date"
298        title="Created"
299        sortable="true" 
300        filterable="true"
301        exportable="true"
302        formatter="<%=dateFormatter%>"
303      />
304      <tbl:columndef 
305        id="entryDate"
306        property="creationEvent.entryDate"
307        datatype="date"
308        title="Registered"
309        sortable="true" 
310        filterable="true"
311        exportable="true"
312        formatter="<%=dateFormatter%>"
313      />
314      <tbl:columndef 
315        id="owner"
316        property="owner.name"
317        datatype="string"
318        title="Owner"
319        sortable="true" 
320        filterable="true"
321        exportable="true"
322      />
323      <tbl:columndef 
324        id="description"
325        property="description"
326        datatype="string"
327        title="Description" 
328        sortable="true" 
329        filterable="true" 
330        exportable="true"
331      />
332      <tbl:columndef
333        id="itemList"
334        property="§itemLists"
335        datatype="int"
336        title="Item list"
337        filterable="true"
338        enumeration="<%=Base.getItemListsEnum(dc, itemType, cc.getInclude())%>"
339      />
340      <%
341      for (AnnotationLoaderUtil loader : annotationLoaders)
342      {
343        AnnotationType at = loader.getAnnotationType();
344        Formatter<Object> formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType());
345        Enumeration<String, String> annotationEnum = null;
346        if (at.isEnumeration())
347        {
348          annotationEnum = new Enumeration<String, String>();
349          if (!at.getDisplayAsList()) annotationEnum.add("", "-none-");
350          List<?> values = at.getValues();
351          for (Object value : values)
352          {
353            String encoded = formatter.format(value);
354            annotationEnum.add(encoded, encoded);
355          }
356        }
357        %>
358        <tbl:columndef 
359          id="<%=(loader.isSearchingInheritedAnnotations() ? "ia" : "at")+at.getId()%>"
360          title="<%=HTML.encodeTags(at.getName())+(loader.isSearchingInheritedAnnotations() ? " [I]" : " [A]")%>" 
361          property="<%=(loader.isSearchingInheritedAnnotations() ? "##" : "#")+at.getId()%>"
362          annotation="true"
363          datatype="<%=at.getValueType().getStringValue()%>"
364          enumeration="<%=annotationEnum%>"
365          smartenum="<%=at.getDisplayAsList() %>"
366          sortable="<%=at.getMultiplicity() == 1 && !loader.isSearchingInheritedAnnotations()%>" 
367          filterable="true" 
368          exportable="true"
369          formatter="<%=formatter%>"
370          unit="<%=at.getDefaultUnit()%>"
371        />
372        <%
373      }
374      %>
375      <tbl:columndef
376        id="permission"
377        title="Permission"
378      />
379      <tbl:columndef
380        id="sharedTo"
381        title="Shared to"
382        filterable="true"
383        filterproperty="!sharedTo.name"
384        datatype="string"
385      />
386      <tbl:columndef 
387        id="xt-columns" 
388        extensions="<%=columnsInvoker%>" 
389        jspcontext="<%=jspContext%>" 
390      />
391      <div class="panelgroup bg-filled-50 bottomborder">
392        <tbl:toolbar
393          subclass="bottomborder"
394          visible="<%=mode.hasToolbar()%>"
395          >
396          <tbl:button 
397            id="btnNewItem"
398            disabled="<%=!createPermission%>" 
399            image="new.png" 
400            title="New&hellip;" 
401            tooltip="<%=createPermission ? "Create new physical bioassay" : "You do not have permission to create physical bioassays"%>" 
402          />
403          <tbl:button
404            id="btnNewMergedDerivedBioAssay"
405            disabled="<%=!createDerivedBioAssayPermission %>"
406            image="add.png"
407            title="New derived bioassay&hellip;"
408            tooltip="<%=createDerivedBioAssayPermission ? "Create new derived bioassay from the selected physical bioassays" : "You do not have permission to create derived bioassays"%>"
409          />
410          <tbl:button 
411            id="btnDeleteItems"
412            image="delete.png"
413            title="Delete" 
414            tooltip="Delete the selected items" 
415          />
416          <tbl:button 
417            id="btnRestoreItems"
418            image="restore.png"
419            title="Restore" 
420            tooltip="Restore the selected (deleted) items"
421          />
422          <tbl:button 
423            id="btnShareItems"
424            image="share.png"
425            title="Share&hellip;" 
426            tooltip="Share the selected items"
427          />
428          <tbl:button 
429            id="btnSetOwner"
430            image="take_ownership.png"
431            title="Set owner&hellip;"
432            tooltip="Change owner of the selected items"
433          />
434          <tbl:button 
435            id="btnColumns"
436            image="columns.png" 
437            title="Columns&hellip;" 
438            tooltip="Show, hide and re-order columns" 
439          />
440          <tbl:button
441            id="btnNewItemList"
442            image="add.png"
443            title="New item list&hellip;"
444            tooltip="Create a new item list from matching bioassays"
445            visible="<%=sc.hasPermission(Permission.CREATE, Item.ITEMLIST)%>"
446          />
447          <tbl:button
448            id="btnAddToItemList"
449            image="add.png"
450            title="Add to item list&hellip;"
451            tooltip="Add bioassays to an existing item list"
452          />
453          <tbl:button
454            id="btnInheritAnnotations"
455            image="inherit.png"
456            title="Inherit annotations&hellip;"
457            tooltip="Batch inherit annotations from parent items"
458          />
459          <tbl:button 
460            id="btnImport"
461            data-plugin-type="IMPORT"
462            image="import.png" 
463            title="Import&hellip;" 
464            tooltip="Import data" 
465            visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
466          />
467          <tbl:button 
468            id="btnExport"
469            data-plugin-type="EXPORT"
470            image="export.png" 
471            title="Export&hellip;" 
472            tooltip="Export data" 
473            visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
474          />
475          <tbl:button 
476            id="btnRunPlugin"
477            data-plugin-type="OTHER"
478            image="runplugin.png" 
479            title="Run plugin&hellip;" 
480            tooltip="Run a plugin" 
481            visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
482          />
483          <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
484            wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/>
485        </tbl:toolbar>
486        <tbl:panel>
487          <tbl:presetselector />
488          <tbl:navigator
489            page="<%=cc.getPage()%>" 
490            rowsperpage="<%=cc.getRowsPerPage()%>" 
491            totalrows="<%=bioAssays == null ? 0 : bioAssays.getTotalCount()%>" 
492            visible="<%=mode.hasNavigator()%>"
493          />
494        </tbl:panel>
495      </div>
496      <tbl:data>
497        <tbl:headers>
498          <tbl:headerrow>
499            <tbl:header colspan="3" />
500            <tbl:columnheaders />
501          </tbl:headerrow>
502          <%
503          int numFilters = cc.getNumPropertyFilters();
504          int numRows = cc.getFilterRows();
505          for (int filterNo = 0; filterNo < numRows; filterNo++)
506          {
507            boolean lastRow = filterNo == numRows-1;
508            %>
509            <tbl:headerrow>
510              <tbl:header subclass="index" />
511              <tbl:header 
512                subclass="check" 
513                visible="<%=mode.hasCheck()%>"
514                ><base:icon 
515                  subclass="link table-check"
516                  image="check_uncheck.png" 
517                  tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" 
518                  visible="<%=lastRow%>"
519                /></tbl:header>
520              <tbl:header 
521                subclass="check" 
522                visible="<%=mode.hasRadio()%>"
523                />
524              <tbl:header 
525                subclass="icons" 
526                visible="<%=mode.hasIcons()%>"
527                >
528                <base:icon
529                  subclass="link table-filter-row-action"
530                  image="add.png"
531                  tooltip="Add extra filter row"
532                  visible="<%=lastRow%>"
533                /><base:icon
534                  subclass="link table-filter-row-action"
535                  image="remove.png"
536                  tooltip="Remove this filter row"
537                  visible="<%=numRows > 1 || numFilters > 0 %>"
538                  data-remove-row="<%=filterNo%>"
539                />
540              </tbl:header>
541              <tbl:propertyfilter row="<%=filterNo%>" />
542            </tbl:headerrow>
543            <%
544          }
545          %>
546        </tbl:headers>
547        <tbl:rows>
548          <%
549          if (cc.getMessage() != null)
550          {
551            %>
552            <tbl:panel subclass="bg-filled-50">
553              <div class="messagecontainer error"><%=cc.getMessage()%></div>
554            </tbl:panel>
555            <%
556            cc.setMessage(null);
557          }
558          int index = cc.getPage()*cc.getRowsPerPage();
559          int selectedItemId = cc.getId();
560          if (bioAssays != null)
561          {           
562            while (bioAssays.hasNext())
563            {
564              PhysicalBioAssay item = bioAssays.next();
565              BioMaterialEvent creationEvent = item.getCreationEvent();
566              int itemId = item.getId();
567              boolean usePermission = item.hasPermission(Permission.USE);
568              boolean deletePermission = item.hasPermission(Permission.DELETE);
569              boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION);
570              boolean writePermission = item.hasPermission(Permission.WRITE);
571              String tooltip = mode.isSelectionMode() ? 
572                  "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : "");
573              String name = HTML.encodeTags(item.getName());
574              index++;
575              numListed++;
576              %>
577              <tbl:row>
578                <tbl:header 
579                  clazz="index"
580                  ><%=index%></tbl:header>
581                <tbl:header 
582                  clazz="check" 
583                  visible="<%=mode.hasCheck()%>"
584                  ><input 
585                    type="checkbox" 
586                    name="<%=itemId%>" 
587                    value="<%=itemId%>" 
588                    title="<%=name%>" 
589                    <%=cc.getSelected().contains(itemId) ? "checked" : ""%> 
590                  ></tbl:header>
591                <tbl:header 
592                  clazz="check" 
593                  visible="<%=mode.hasRadio()%>"
594                  ><input 
595                    type="radio" 
596                    name="item_id" 
597                    value="<%=itemId%>" 
598                    title="<%=name%>" 
599                    <%=selectedItemId == itemId ? "checked" : ""%>
600                  ></tbl:header>
601                <tbl:header 
602                  clazz="icons" 
603                  visible="<%=mode.hasIcons()%>"
604                  ><base:icon 
605                    image="deleted.png"
606                    id="<%="delete."+itemId %>"
607                    subclass="<%=deletePermission ? "table-delete-item" : "disabled" %>"
608                    data-item-id="<%=itemId%>"
609                    tooltip="This item has been scheduled for deletion" 
610                    visible="<%=item.isRemoved()%>"
611                  /><base:icon 
612                    image="shared.png" 
613                    id="<%="share."+itemId %>"
614                    subclass="<%=sharePermission ? "table-share-item" : "disabled" %>"
615                    data-item-id="<%=itemId%>"
616                    tooltip="This item is shared to other users, groups and/or projects" 
617                    visible="<%=item.isShared()%>"
618                  />&nbsp;</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="itemSubtype"><base:propertyvalue 
627                    item="<%=item%>" 
628                    property="itemSubtype"
629                    enableEditLink="<%=mode.hasEditLink()%>" 
630                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
631                  /></tbl:cell>
632                <tbl:cell column="size"><%=item.getSize()%></tbl:cell>
633                <tbl:cell column="extracts">
634                  <%
635                  extractQuery.setParameter("bioAssay", itemId, Type.INT);
636                  try
637                  {
638                    String separator = "";
639                    boolean needIndex = item.getSize() > 1;
640                    for (Extract extract : extractQuery.list(dc))
641                    {
642                      Float usedQuantity = creationEvent.getUsedQuantity(extract);
643                      Tag tag = null;
644                      boolean readTag = true;
645                      try
646                      {
647                        tag = extract.getTag();
648                      }
649                      catch (PermissionDeniedException ex)
650                      {
651                        readTag = false;
652                      }
653                      out.write(separator);
654                      if (needIndex)
655                      {
656                        out.write(creationEvent.getEventSource(extract).getPosition() + ": ");
657                      }
658                      if (mode.hasPropertyLink())
659                      {
660                        out.write(Base.getLinkedName(ID, extract, false, mode.hasEditLink()));
661                      }
662                      else
663                      {
664                        out.write(HTML.encodeTags(extract.getName()));
665                      }
666                      if (tag != null || usedQuantity != null)
667                      {
668                        out.write(" (");
669                        if (usedQuantity != null)
670                        {
671                          out.write(numericFormatter.format(usedQuantity) + "µg");
672                          if (tag != null) out.write("; ");
673                        }
674                        if (tag != null)
675                        {
676                          if (mode.hasPropertyLink())
677                          {
678                            out.write(Base.getLinkedName(ID, tag, !readTag, mode.hasEditLink()));
679                          }
680                          else
681                          {
682                            out.write(" (" + Base.getEncodedName(tag, !readTag));
683                          }
684                        }
685                        out.write(")");
686                      }
687                      separator = ", ";
688                    }
689                  }
690                  catch (Throwable t)
691                  {
692                    %>
693                    <div class="error"><%=t.getMessage()%></div>
694                    <%
695                  }
696                  %>             
697                </tbl:cell>
698                <tbl:cell column="arraySlide"
699                  ><base:propertyvalue 
700                    item="<%=item%>" 
701                    property="arraySlide"
702                    enableEditLink="<%=mode.hasEditLink()%>" 
703                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
704                  /></tbl:cell>
705                <tbl:cell column="derivedBioAssays">
706                  <%
707                  dbasQuery.setParameter("bioAssay", itemId, Type.INT);
708                  %>
709                  <%=Values.getString(dbasQuery.list(dc), ", ", false, nameableFormatter) %>
710                  <base:icon
711                    subclass="link auto-init"
712                    data-auto-init="new-derived-bioassay"
713                    data-item-id="<%=itemId %>"
714                    image="add.png" 
715                    tooltip="Create new derived bioassay" 
716                    visible="<%=mode.hasEditLink() && createDerivedBioAssayPermission && usePermission %>"
717                  />
718                </tbl:cell>
719                <tbl:cell column="itemList">
720                  <%
721                  listQuery.setParameter("itemId", itemId, Type.INT);
722                  %>
723                  <%=Values.getString(listQuery.list(dc), ", ", false, nameableFormatter) %>
724                </tbl:cell>
725                <tbl:cell column="protocol"
726                  ><base:propertyvalue 
727                    item="<%=creationEvent%>" 
728                    property="protocol"
729                    enableEditLink="<%=mode.hasEditLink()%>" 
730                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
731                  /></tbl:cell>
732                <tbl:cell column="hardware"
733                  ><base:propertyvalue 
734                    item="<%=creationEvent%>"
735                    property="hardware"
736                    enableEditLink="<%=mode.hasEditLink()%>" 
737                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
738                  /></tbl:cell>
739                <tbl:cell column="kit"
740                  ><base:propertyvalue 
741                    item="<%=creationEvent%>" 
742                    property="kit"
743                    enableEditLink="<%=mode.hasEditLink()%>" 
744                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
745                  /></tbl:cell>
746                <tbl:cell column="eventDate" value="<%=creationEvent.getEventDate()%>" />
747                <tbl:cell column="entryDate" value="<%=creationEvent.getEntryDate()%>" />
748                <tbl:cell column="owner"
749                  ><base:propertyvalue 
750                    item="<%=item%>" 
751                    property="owner"
752                    enableEditLink="<%=mode.hasEditLink()%>" 
753                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
754                  /></tbl:cell>
755                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
756                <%
757                if (item.isAnnotated())
758                {
759                  AnnotationSetSnapshot snapshot = manager.getSnapshot(dc, item.getAnnotationSet().getId());
760                  for (AnnotationLoaderUtil loader : annotationLoaders)
761                  {
762                    %>
763                    <tbl:cell 
764                      column="<%=(loader.isSearchingInheritedAnnotations() ? "ia" : "at")+loader.getId()%>"
765                      ><%
766                      if (loader.find(snapshot, psInfo.reset())) 
767                      {
768                        %><tbl:cellvalue 
769                          list="<%=loader.getValues()%>"
770                          suffix="<%=loader.getUnitSymbol()%>"
771                          clazz="<%=psInfo.overridesDefaultAnnotation() ? "ps-annotation" : null%>"
772                        /><%
773                      }
774                      %></tbl:cell>
775                    <%
776                  }
777                }
778                %>
779                <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell>
780                <tbl:cell column="sharedTo">
781                  <%=Values.getString(ShareableUtil.getSharedTo(dc, item), ", ", false, nameableFormatter) %>
782                </tbl:cell>
783                <tbl:xt-cells dc="<%=dc%>" item="<%=item%>">
784                  <tbl:cell column="xt-columns" />
785                </tbl:xt-cells>
786              </tbl:row>
787              <%
788              }
789            }
790          if (numListed == 0)
791          {
792            %>
793            <tbl:panel subclass="bg-filled-50">
794              <div class="messagecontainer note">
795              <%=bioAssays == null || bioAssays.getTotalCount() == 0 ? "No physical bioassays were found" : "No physical bioassays on this page. Please select another page!" %>
796              </div>
797            </tbl:panel>
798            <%
799          }
800          %>
801        </tbl:rows>
802      </tbl:data>
803    </tbl:table>
804    </div>
805   
806    <base:buttongroup subclass="dialogbuttons">
807      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
808      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
809      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
810    </base:buttongroup>
811   
812  </base:body>
813  </base:page>
814  <%
815}
816finally
817{
818  if (bioAssays != null) bioAssays.close();
819  if (dc != null) dc.close();
820}
821%>
Note: See TracBrowser for help on using the repository browser.