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

Last change on this file since 6690 was 6690, checked in by Nicklas Nordborg, 8 years ago

References #1906: Display inherited annotations in list views

Implemented this for samples, extracts physical bioassays, derived bioassays and array (slide/batch/desing) list views

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 24.5 KB
Line 
1<%-- $Id: list_bioassays.jsp 6690 2015-01-21 12:25:49Z 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      subclass="fulltable"
171      data-inherited-annotations="true"
172      >
173      <tbl:hidden 
174        name="mode" 
175        value="<%=mode.getName()%>" 
176      />
177      <tbl:hidden 
178        name="callback" 
179        value="<%=callback%>" 
180        skip="<%=callback == null%>" 
181      />
182      <tbl:columndef 
183        id="name"
184        property="name"
185        datatype="string"
186        title="Name"
187        sortable="true" 
188        filterable="true"
189        exportable="true"
190        show="always" 
191      />
192      <tbl:columndef 
193        id="itemSubtype"
194        property="itemSubtype"
195        sortproperty="itemSubtype.name"
196        exportproperty="itemSubtype.name:string"
197        datatype="int"
198        enumeration="<%=Enumeration.fromItems(subtypesQuery.list(dc), "-none-")%>"
199        title="Type"
200        sortable="true" 
201        filterable="true"
202        exportable="true"
203      />
204      <tbl:columndef
205        id="id"
206        clazz="uniquecol"
207        property="id"
208        datatype="int"
209        title="ID"
210        sortable="true"
211        filterable="true"
212        exportable="true"
213      />
214      <tbl:columndef 
215        id="size"
216        property="size"
217        datatype="int"
218        title="Size"
219        sortable="true" 
220        filterable="true"
221        exportable="true"
222      />
223      <tbl:columndef
224        id="extracts"
225        title="Extracts"
226        property="&creationEvent.sources(bioMaterial.name)"
227        datatype="string"
228        filterable="true"
229        exportable="true"
230      />
231      <tbl:columndef 
232        id="arraySlide"
233        property="arraySlide.name"
234        datatype="string"
235        title="Array slide"
236        sortable="true" 
237        filterable="true"
238        exportable="true"
239      />
240      <tbl:columndef
241        id="derivedBioAssays"
242        title="Derived bioassays"
243        property="&rootDerivedBioAssays(%name)"
244        datatype="string"
245        filterable="true"
246        exportable="true"
247      />
248      <tbl:columndef 
249        id="protocol"
250        property="creationEvent.protocol.name"
251        datatype="string"
252        title="Protocol"
253        sortable="true" 
254        filterable="true"
255        exportable="true"
256      />
257      <tbl:columndef
258        id="hardware"
259        property="creationEvent.hardware.name"
260        datatype="string"
261        title="Hardware"
262        sortable="true"
263        filterable="true"
264        exportable="true"
265      />
266      <tbl:columndef 
267        id="eventDate"
268        property="creationEvent.eventDate"
269        datatype="date"
270        title="Created"
271        sortable="true" 
272        filterable="true"
273        exportable="true"
274        formatter="<%=dateFormatter%>"
275      />
276      <tbl:columndef 
277        id="entryDate"
278        property="creationEvent.entryDate"
279        datatype="date"
280        title="Registered"
281        sortable="true" 
282        filterable="true"
283        exportable="true"
284        formatter="<%=dateFormatter%>"
285      />
286      <tbl:columndef 
287        id="owner"
288        property="owner.name"
289        datatype="string"
290        title="Owner"
291        sortable="true" 
292        filterable="true"
293        exportable="true"
294      />
295      <tbl:columndef 
296        id="description"
297        property="description"
298        datatype="string"
299        title="Description" 
300        sortable="true" 
301        filterable="true" 
302        exportable="true"
303      />
304      <%
305      for (AnnotationLoaderUtil loader : annotationLoaders)
306      {
307        AnnotationType at = loader.getAnnotationType();
308        Formatter formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType());
309        Enumeration<String, String> annotationEnum = null;
310        if (at.isEnumeration())
311        {
312          annotationEnum = new Enumeration<String, String>();
313          List<?> values = at.getValues();
314          for (Object value : values)
315          {
316            String encoded = formatter.format(value);
317            annotationEnum.add(encoded, encoded);
318          }
319        }
320        %>
321        <tbl:columndef 
322          id="<%=(loader.isSearchingInheritedAnnotations() ? "ia" : "at")+at.getId()%>"
323          title="<%=HTML.encodeTags(at.getName())+(loader.isSearchingInheritedAnnotations() ? " [I]" : " [A]")%>" 
324          property="<%=(loader.isSearchingInheritedAnnotations() ? "##" : "#")+at.getId()%>"
325          annotation="true"
326          datatype="<%=at.getValueType().getStringValue()%>"
327          enumeration="<%=annotationEnum%>"
328          smartenum="<%=at.getDisplayAsList() %>"
329          sortable="<%=at.getMultiplicity() == 1 && !loader.isSearchingInheritedAnnotations()%>" 
330          filterable="true" 
331          exportable="true"
332          formatter="<%=formatter%>"
333          unit="<%=at.getDefaultUnit()%>"
334        />
335        <%
336      }
337      %>
338      <tbl:columndef
339        id="permission"
340        title="Permission"
341      />
342      <tbl:columndef
343        id="sharedTo"
344        title="Shared to"
345        filterable="true"
346        filterproperty="!sharedTo.name"
347        datatype="string"
348      />
349      <tbl:columndef 
350        id="xt-columns" 
351        extensions="<%=columnsInvoker%>" 
352        jspcontext="<%=jspContext%>" 
353      />
354      <div class="panelgroup bg-filled-50 bottomborder">
355        <tbl:toolbar
356          subclass="bottomborder"
357          visible="<%=mode.hasToolbar()%>"
358          >
359          <tbl:button 
360            id="btnNewItem"
361            disabled="<%=!createPermission%>" 
362            image="new.png" 
363            title="New&hellip;" 
364            tooltip="<%=createPermission ? "Create new physical bioassay" : "You do not have permission to create physical bioassays"%>" 
365          />
366          <tbl:button
367            id="btnNewMergedDerivedBioAssay"
368            disabled="<%=!createDerivedBioAssayPermission %>"
369            image="add.png"
370            title="New derived bioassay&hellip;"
371            tooltip="<%=createDerivedBioAssayPermission ? "Create new derived bioassay from the selected physical bioassays" : "You do not have permission to create derived bioassays"%>"
372          />
373          <tbl:button 
374            id="btnDeleteItems"
375            image="delete.png"
376            title="Delete" 
377            tooltip="Delete the selected items" 
378          />
379          <tbl:button 
380            id="btnRestoreItems"
381            image="restore.png"
382            title="Restore" 
383            tooltip="Restore the selected (deleted) items"
384          />
385          <tbl:button 
386            id="btnShareItems"
387            image="share.png"
388            title="Share&hellip;" 
389            tooltip="Share the selected items"
390          />
391          <tbl:button 
392            id="btnSetOwner"
393            image="take_ownership.png"
394            title="Set owner&hellip;"
395            tooltip="Change owner of the selected items"
396          />
397          <tbl:button 
398            id="btnColumns"
399            image="columns.png" 
400            title="Columns&hellip;" 
401            tooltip="Show, hide and re-order columns" 
402          />
403          <tbl:button 
404            id="btnImport"
405            data-plugin-type="IMPORT"
406            image="import.png" 
407            title="Import&hellip;" 
408            tooltip="Import data" 
409            visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
410          />
411          <tbl:button 
412            id="btnExport"
413            data-plugin-type="EXPORT"
414            image="export.png" 
415            title="Export&hellip;" 
416            tooltip="Export data" 
417            visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
418          />
419          <tbl:button 
420            id="btnRunPlugin"
421            data-plugin-type="OTHER"
422            image="runplugin.png" 
423            title="Run plugin&hellip;" 
424            tooltip="Run a plugin" 
425            visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
426          />
427          <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
428            wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
429        </tbl:toolbar>
430        <tbl:panel>
431          <tbl:presetselector />
432          <tbl:navigator
433            page="<%=cc.getPage()%>" 
434            rowsperpage="<%=cc.getRowsPerPage()%>" 
435            totalrows="<%=bioAssays == null ? 0 : bioAssays.getTotalCount()%>" 
436            visible="<%=mode.hasNavigator()%>"
437          />
438        </tbl:panel>
439      </div>
440      <tbl:data>
441        <tbl:headers>
442          <tbl:headerrow>
443            <tbl:header colspan="3" />
444            <tbl:columnheaders />
445          </tbl:headerrow>
446          <tbl:headerrow>
447            <tbl:header subclass="index" />
448            <tbl:header 
449              subclass="check" 
450              visible="<%=mode.hasCheck()%>"
451              ><base:icon 
452                id="check.uncheck"
453                image="check_uncheck.png" 
454                tooltip="Check/uncheck all" 
455              /></tbl:header>
456            <tbl:header 
457              subclass="check" 
458              visible="<%=mode.hasRadio()%>"
459              />
460            <tbl:header 
461              subclass="icons" 
462              visible="<%=mode.hasIcons()%>"
463              />
464            <tbl:propertyfilter />
465          </tbl:headerrow>
466        </tbl:headers>
467        <tbl:rows>
468          <%
469          if (cc.getMessage() != null)
470          {
471            %>
472            <tbl:panel subclass="bg-filled-50">
473              <div class="messagecontainer error"><%=cc.getMessage()%></div>
474            </tbl:panel>
475            <%
476            cc.setMessage(null);
477          }
478          int index = cc.getPage()*cc.getRowsPerPage();
479          int selectedItemId = cc.getId();
480          if (bioAssays != null)
481          {           
482            while (bioAssays.hasNext())
483            {
484              PhysicalBioAssay item = bioAssays.next();
485              BioMaterialEvent creationEvent = item.getCreationEvent();
486              int itemId = item.getId();
487              boolean usePermission = item.hasPermission(Permission.USE);
488              boolean deletePermission = item.hasPermission(Permission.DELETE);
489              boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION);
490              boolean writePermission = item.hasPermission(Permission.WRITE);
491              String tooltip = mode.isSelectionMode() ? 
492                  "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : "");
493              String name = HTML.encodeTags(item.getName());
494              index++;
495              numListed++;
496              %>
497              <tbl:row>
498                <tbl:header 
499                  clazz="index"
500                  ><%=index%></tbl:header>
501                <tbl:header 
502                  clazz="check" 
503                  visible="<%=mode.hasCheck()%>"
504                  ><input 
505                    type="checkbox" 
506                    name="<%=itemId%>" 
507                    value="<%=itemId%>" 
508                    title="<%=name%>" 
509                    <%=cc.getSelected().contains(itemId) ? "checked" : ""%> 
510                  ></tbl:header>
511                <tbl:header 
512                  clazz="check" 
513                  visible="<%=mode.hasRadio()%>"
514                  ><input 
515                    type="radio" 
516                    name="item_id" 
517                    value="<%=itemId%>" 
518                    title="<%=name%>" 
519                    <%=selectedItemId == itemId ? "checked" : ""%>
520                  ></tbl:header>
521                <tbl:header 
522                  clazz="icons" 
523                  visible="<%=mode.hasIcons()%>"
524                  ><base:icon 
525                    image="deleted.png"
526                    id="<%="delete."+itemId %>"
527                    subclass="<%=deletePermission ? "table-delete-item" : null %>"
528                    data-item-id="<%=itemId%>"
529                    tooltip="This item has been scheduled for deletion" 
530                    visible="<%=item.isRemoved()%>"
531                  /><base:icon 
532                    image="shared.png" 
533                    id="<%="share."+itemId %>"
534                    subclass="<%=sharePermission ? "table-share-item" : null %>"
535                    data-item-id="<%=itemId%>"
536                    tooltip="This item is shared to other users, groups and/or projects" 
537                    visible="<%=item.isShared()%>"
538                  />&nbsp;</tbl:header>
539                <tbl:cell column="name"><div
540                  class="link table-item"
541                  data-item-id="<%=itemId%>"
542                  data-no-edit="<%=writePermission ? 0 : 1 %>" 
543                  tabindex="0"
544                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
545                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
546                <tbl:cell column="itemSubtype"><base:propertyvalue 
547                    item="<%=item%>" 
548                    property="itemSubtype"
549                    enableEditLink="<%=mode.hasEditLink()%>" 
550                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
551                  /></tbl:cell>
552                <tbl:cell column="size"><%=item.getSize()%></tbl:cell>
553                <tbl:cell column="extracts">
554                  <%
555                  extractQuery.setParameter("bioAssay", itemId, Type.INT);
556                  try
557                  {
558                    String separator = "";
559                    boolean needIndex = item.getSize() > 1;
560                    for (Extract extract : extractQuery.list(dc))
561                    {
562                      Float usedQuantity = creationEvent.getUsedQuantity(extract);
563                      Tag tag = null;
564                      boolean readTag = true;
565                      try
566                      {
567                        tag = extract.getTag();
568                      }
569                      catch (PermissionDeniedException ex)
570                      {
571                        readTag = false;
572                      }
573                      out.write(separator);
574                      if (needIndex)
575                      {
576                        out.write(creationEvent.getEventSource(extract).getPosition() + ": ");
577                      }
578                      if (mode.hasPropertyLink())
579                      {
580                        out.write(Base.getLinkedName(ID, extract, false, mode.hasEditLink()));
581                      }
582                      else
583                      {
584                        out.write(HTML.encodeTags(extract.getName()));
585                      }
586                      if (tag != null || usedQuantity != null)
587                      {
588                        out.write(" (");
589                        if (usedQuantity != null)
590                        {
591                          out.write(numericFormatter.format(usedQuantity) + "µg");
592                          if (tag != null) out.write("; ");
593                        }
594                        if (tag != null)
595                        {
596                          if (mode.hasPropertyLink())
597                          {
598                            out.write(Base.getLinkedName(ID, tag, !readTag, mode.hasEditLink()));
599                          }
600                          else
601                          {
602                            out.write(" (" + Base.getEncodedName(tag, !readTag));
603                          }
604                        }
605                        out.write(")");
606                      }
607                      separator = ", ";
608                    }
609                  }
610                  catch (Throwable t)
611                  {
612                    %>
613                    <div class="error"><%=t.getMessage()%></div>
614                    <%
615                  }
616                  %>             
617                </tbl:cell>
618                <tbl:cell column="arraySlide"
619                  ><base:propertyvalue 
620                    item="<%=item%>" 
621                    property="arraySlide"
622                    enableEditLink="<%=mode.hasEditLink()%>" 
623                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
624                  /></tbl:cell>
625                <tbl:cell column="derivedBioAssays">
626                  <%
627                  dbasQuery.setParameter("bioAssay", itemId, Type.INT);
628                  try
629                  {
630                    String separator = "";
631                    for (DerivedBioAssay dbas : dbasQuery.list(dc))
632                    {
633                      out.write(separator);
634                      if (mode.hasPropertyLink())
635                      {
636                        out.write(Base.getLinkedName(ID, dbas, false, mode.hasEditLink()));
637                      }
638                      else
639                      {
640                        out.write(HTML.encodeTags(dbas.getName()));
641                      }
642                      separator = ", ";
643                    }
644                  }
645                  catch (Throwable t)
646                  {
647                    %>
648                    <div class="error"><%=t.getMessage()%></div>
649                    <%
650                  }
651                  %>
652                  <base:icon
653                    subclass="link auto-init"
654                    data-auto-init="new-derived-bioassay"
655                    data-item-id="<%=itemId %>"
656                    image="add.png" 
657                    tooltip="Create new derived bioassay" 
658                    visible="<%=mode.hasEditLink() && createDerivedBioAssayPermission && usePermission %>"
659                  />
660                </tbl:cell>
661                <tbl:cell column="protocol"
662                  ><base:propertyvalue 
663                    item="<%=creationEvent%>" 
664                    property="protocol"
665                    enableEditLink="<%=mode.hasEditLink()%>" 
666                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
667                  /></tbl:cell>
668                <tbl:cell column="hardware"
669                  ><base:propertyvalue 
670                    item="<%=creationEvent%>"
671                    property="hardware"
672                    enableEditLink="<%=mode.hasEditLink()%>" 
673                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
674                  /></tbl:cell>
675                <tbl:cell column="eventDate" value="<%=creationEvent.getEventDate()%>" />
676                <tbl:cell column="entryDate" value="<%=creationEvent.getEntryDate()%>" />
677                <tbl:cell column="owner"
678                  ><base:propertyvalue 
679                    item="<%=item%>" 
680                    property="owner"
681                    enableEditLink="<%=mode.hasEditLink()%>" 
682                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
683                  /></tbl:cell>
684                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
685                <%
686                if (item.isAnnotated())
687                {
688                  AnnotationSetSnapshot snapshot = manager.getSnapshot(dc, item.getAnnotationSet().getId());
689                  for (AnnotationLoaderUtil loader : annotationLoaders)
690                  {
691                    if (loader.find(snapshot))
692                    {
693                      %>
694                      <tbl:cell 
695                        column="<%=(loader.isSearchingInheritedAnnotations() ? "ia" : "at")+loader.getId()%>"
696                        ><tbl:cellvalue 
697                          list="<%=loader.getValues()%>"
698                          suffix="<%=loader.getUnitSymbol()%>"
699                      /></tbl:cell>
700                      <%
701                    }
702                  }
703                }
704                %>
705                <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell>
706                <tbl:cell column="sharedTo">
707                  <%
708                  Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator();
709                  while(sharees.hasNext())
710                  {
711                    Nameable n = sharees.next();
712                    if (mode.hasPropertyLink())
713                    {
714                      out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink()));
715                    }
716                    else
717                    {
718                      out.write(HTML.encodeTags(n.getName()));
719                    }
720                    out.write(sharees.hasNext() ? ", " : "");
721                  }
722                  %>
723                </tbl:cell>
724                <tbl:xt-cells dc="<%=dc%>" item="<%=item%>">
725                  <tbl:cell column="xt-columns" />
726                </tbl:xt-cells>
727              </tbl:row>
728              <%
729              }
730            }
731          if (numListed == 0)
732          {
733            %>
734            <tbl:panel subclass="bg-filled-50">
735              <div class="messagecontainer note">
736              <%=bioAssays == null || bioAssays.getTotalCount() == 0 ? "No physical bioassays were found" : "No physical bioassays on this page. Please select another page!" %>
737              </div>
738            </tbl:panel>
739            <%
740          }
741          %>
742        </tbl:rows>
743      </tbl:data>
744    </tbl:table>
745    </div>
746   
747    <base:buttongroup subclass="dialogbuttons">
748      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
749      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
750      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
751    </base:buttongroup>
752   
753  </base:body>
754  </base:page>
755  <%
756}
757finally
758{
759  if (bioAssays != null) bioAssays.close();
760  if (dc != null) dc.close();
761}
762%>
Note: See TracBrowser for help on using the repository browser.