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

Last change on this file since 5674 was 5674, checked in by Nicklas Nordborg, 12 years ago

Fixes #1611: Checkbox enabled lists for enumerated annotations

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