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

Last change on this file since 6699 was 6699, checked in by Nicklas Nordborg, 9 years ago

References #1912: Add more filter rows in list pages

Fixes a problem with using non-unique id for the 'Add filter row' icon when used on pages that has multiple lists. This caused the icon to not work or add rows to the incorrect list.

The add/remove icons are now based on class names instead which means we can target each icon within the table context it is defined in.

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