source: trunk/www/views/derivedbioassays/list_bioassays.jsp @ 7773

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

References #2202: Include information from parent items in list pages

Implemented a simple dialog for selecting parent item columns. It currently allows selecting to display the name of a parent item or any annotation that is attached to it. It can probably be improved a bit more.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 30.0 KB
Line 
1<%-- $Id: list_bioassays.jsp 7773 2020-02-17 10:10:58Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2011 Nicklas Nordborg
4
5  This file is part of BASE - BioArray Software Environment.
6  Available at http://base.thep.lu.se/
7
8  BASE is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License
10  as published by the Free Software Foundation; either version 3
11  of the License, or (at your option) any later version.
12
13  BASE is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with BASE. If not, see <http://www.gnu.org/licenses/>.
20  ------------------------------------------------------------------
21
22--%>
23<%@ page pageEncoding="UTF-8" session="false"
24  import="net.sf.basedb.core.SessionControl"
25  import="net.sf.basedb.core.DbControl"
26  import="net.sf.basedb.core.Item"
27  import="net.sf.basedb.core.PhysicalBioAssay"
28  import="net.sf.basedb.core.DerivedBioAssay"
29  import="net.sf.basedb.core.RawBioAssay"
30  import="net.sf.basedb.core.BioMaterialEvent"
31  import="net.sf.basedb.core.AnnotationType"
32  import="net.sf.basedb.core.AnnotationSet"
33  import="net.sf.basedb.core.Annotation"
34  import="net.sf.basedb.core.ItemSubtype"
35  import="net.sf.basedb.core.FileSet"
36  import="net.sf.basedb.core.DataFileType"
37  import="net.sf.basedb.core.ItemQuery"
38  import="net.sf.basedb.core.Include"
39  import="net.sf.basedb.core.Type"
40  import="net.sf.basedb.core.ItemResultIterator"
41  import="net.sf.basedb.core.ItemResultList"
42  import="net.sf.basedb.core.ItemContext"
43  import="net.sf.basedb.core.Nameable"
44  import="net.sf.basedb.core.Permission"
45  import="net.sf.basedb.core.PermissionDeniedException"
46  import="net.sf.basedb.core.PluginDefinition"
47  import="net.sf.basedb.core.query.Hql"
48  import="net.sf.basedb.core.query.Restrictions"
49  import="net.sf.basedb.core.query.Expressions"
50  import="net.sf.basedb.core.query.Orders"
51  import="net.sf.basedb.core.query.Hql"
52  import="net.sf.basedb.core.plugin.GuiContext"
53  import="net.sf.basedb.core.plugin.Plugin"
54  import="net.sf.basedb.core.snapshot.AnnotationLoaderUtil"
55  import="net.sf.basedb.core.snapshot.AnnotationTypeFilter"
56  import="net.sf.basedb.core.snapshot.AnnotationSnapshot"
57  import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot"
58  import="net.sf.basedb.core.snapshot.SnapshotManager"
59  import="net.sf.basedb.util.Enumeration"
60  import="net.sf.basedb.util.ShareableUtil"
61  import="net.sf.basedb.clients.web.Base"
62  import="net.sf.basedb.clients.web.ModeInfo"
63  import="net.sf.basedb.clients.web.PermissionUtil"
64  import="net.sf.basedb.clients.web.util.HTML"
65  import="net.sf.basedb.util.formatter.Formatter"
66  import="net.sf.basedb.clients.web.formatter.DataFileFormatter"
67  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
68  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
69  import="net.sf.basedb.clients.web.extensions.JspContext"
70  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
71  import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" 
72  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
73  import="net.sf.basedb.clients.web.extensions.list.ListColumnAction"
74  import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil"
75  import="net.sf.basedb.clients.web.util.ProjectSpecificInfoFilter"
76  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
77  import="net.sf.basedb.util.Values"
78  import="java.util.Iterator"
79  import="java.util.List"
80  import="java.util.Map"
81  import="java.util.Date"
82  import="java.util.ArrayList"
83%>
84<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
85<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
86<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
87<%!
88  private static final Item itemType = Item.DERIVEDBIOASSAY;
89  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST);
90%>
91<%
92final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType);
93final String ID = sc.getId();
94final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType);
95final boolean createRawBioAssayPermission = sc.hasPermission(Permission.CREATE, Item.RAWBIOASSAY);
96final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
97
98final ModeInfo mode = ModeInfo.get(request.getParameter("mode"));
99final String callback = request.getParameter("callback");
100final String title = mode.generateTitle("derived bioassay", "derived bioassays");
101final DbControl dc = sc.newDbControl();
102ItemResultIterator<DerivedBioAssay> bioAssays = null;
103List<AnnotationLoaderUtil> annotationLoaders = new ArrayList<AnnotationLoaderUtil>();
104try
105{
106  ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType);
107  SnapshotManager manager = new SnapshotManager();
108  ProjectSpecificInfoFilter psInfo = new ProjectSpecificInfoFilter();
109  for (AnnotationType at : annotationTypeQuery.list(dc))
110  {
111    annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at));
112  }
113  annotationTypeQuery = Base.getInheritedAnnotationColumns(cc.getSetting("columns"));
114  for (AnnotationType at : annotationTypeQuery.list(dc))
115  {
116    annotationLoaders.add(new AnnotationLoaderUtil(dc, manager, at, false, true));
117  }
118  List<DataFileType> fileTypeColumns = new ArrayList<DataFileType>(Base.getDataFileColumns(itemType, null).list(dc));
119 
120  final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType);
121  final ItemQuery<ItemSubtype> jobSubtypesQuery = Base.getSubtypesQuery(Item.JOB);
122
123  // Query for parent physical bioassays to the current bioassay
124  final ItemQuery<PhysicalBioAssay> physicalBioAssayQuery = PhysicalBioAssay.getQuery();
125  physicalBioAssayQuery.include(cc.getInclude());
126  physicalBioAssayQuery.join(Hql.innerJoin("derivedBioAssays", "dba"));
127  physicalBioAssayQuery.restrict(Restrictions.eq(Hql.alias("dba"), Expressions.parameter("bioAssay")));
128  physicalBioAssayQuery.order(Orders.asc(Hql.property("name"))); 
129
130  // Query for parent bioassays to the current bioassay
131  final ItemQuery<DerivedBioAssay> parentQuery = DerivedBioAssay.getQuery();
132  parentQuery.include(cc.getInclude());
133  parentQuery.join(Hql.innerJoin("children", "c"));
134  parentQuery.restrict(Restrictions.eq(Hql.alias("c"), Expressions.parameter("bioAssay")));
135  parentQuery.order(Orders.asc(Hql.property("name"))); 
136
137  // Query for child bioassays to the current bioassay
138  final ItemQuery<DerivedBioAssay> childQuery = DerivedBioAssay.getQuery();
139  childQuery.include(cc.getInclude());
140  childQuery.join(Hql.innerJoin("parents", "p"));
141  childQuery.restrict(Restrictions.eq(Hql.alias("p"), Expressions.parameter("bioAssay")));
142  childQuery.order(Orders.asc(Hql.property("name"))); 
143
144  // Query for raw bioassays to the current bioassay
145  final ItemQuery<RawBioAssay> rawBioAssayQuery = RawBioAssay.getQuery();
146  rawBioAssayQuery.include(cc.getInclude());
147  rawBioAssayQuery.restrict(Restrictions.eq(Hql.property("parentBioAssay"), Expressions.parameter("bioAssay")));
148  rawBioAssayQuery.order(Orders.asc(Hql.property("name"))); 
149 
150  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
151  try
152  {
153    final ItemQuery<DerivedBioAssay> query = Base.getConfiguredQuery(dc, cc, true, DerivedBioAssay.getQuery(), mode);
154    bioAssays = query.iterate(dc);
155  }
156  catch (Throwable t)
157  {
158    cc.setMessage(t.getMessage());
159    t.printStackTrace();
160  }
161  int numListed = 0;
162  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
163  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null);
164  ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext);
165  ExtensionsInvoker<ListColumnAction<DerivedBioAssay,?>> columnsInvoker = ListColumnUtil.useExtensions(jspContext);
166  %>
167  <base:page title="<%=title==null ? "Derived bioassays" : title%>" type="<%=mode.getPageType()%>" id="list-page">
168  <base:head scripts="table.js,~bioassays.js" styles="table.css,toolbar.css">
169    <ext:scripts context="<%=jspContext%>" />
170    <ext:stylesheets context="<%=jspContext%>" />
171  </base:head>
172 
173  <base:body>
174    <h1><%=title==null ? "Derived bioassays" : title%></h1>
175    <div class="content">
176    <tbl:table 
177      id="bioassays" 
178      columns="<%=cc.getSetting("columns")%>"
179      sortby="<%=cc.getSortProperty()%>" 
180      direction="<%=cc.getSortDirection()%>"
181      action="index.jsp"
182      sc="<%=sc%>"
183      item="<%=itemType%>"
184      filterrows="<%=cc.getFilterRows()%>"
185      subclass="fulltable"
186      data-inherited-annotations="true"
187      data-parent-columns="true"
188      >
189      <tbl:hidden 
190        name="mode" 
191        value="<%=mode.getName()%>" 
192      />
193      <tbl:hidden 
194        name="callback" 
195        value="<%=callback%>" 
196        skip="<%=callback == null%>" 
197      />
198      <tbl:columndef 
199        id="name"
200        property="name"
201        datatype="string"
202        title="Name"
203        sortable="true" 
204        filterable="true"
205        exportable="true"
206        show="always" 
207      />
208      <tbl:columndef 
209        id="itemSubtype"
210        property="itemSubtype"
211        sortproperty="itemSubtype.name"
212        exportproperty="itemSubtype.name:string"
213        datatype="int"
214        enumeration="<%=Enumeration.fromItems(subtypesQuery.list(dc), "-none-")%>"
215        title="Type"
216        sortable="true" 
217        filterable="true"
218        exportable="true"
219      />
220      <tbl:columndef
221        id="id"
222        clazz="uniquecol"
223        property="id"
224        datatype="int"
225        title="ID"
226        sortable="true"
227        filterable="true"
228        exportable="true"
229      />
230      <tbl:columndef 
231        id="physicalBioAssays"
232        property="&physicalBioAssays(name)"
233        datatype="string"
234        title="Physical bioassays"
235        filterable="true"
236        exportable="true"
237      />
238      <tbl:columndef 
239        id="parents"
240        property="&parents(name)"
241        datatype="string"
242        title="Parent bioassays"
243        filterable="true"
244        exportable="true"
245      />
246      <tbl:columndef
247        id="children"
248        title="Child bioassays"
249        property="&children(name)"
250        datatype="string"
251        filterable="true"
252        exportable="true"
253      />
254      <tbl:columndef 
255        id="extract"
256        property="extract.name"
257        datatype="string"
258        title="Extract"
259        sortable="true" 
260        filterable="true"
261        exportable="true"
262      />
263      <tbl:columndef
264        id="rawBioAssays"
265        title="Raw bioassays"
266        property="&rawBioAssays(name)"
267        datatype="string"
268        filterable="true"
269        exportable="true"
270      />
271      <tbl:columndef 
272        id="jobType"
273        property="job.itemSubtype"
274        sortproperty="job.itemSubtype.name"
275        exportproperty="job.itemSubtype.name:string"
276        datatype="int"
277        enumeration="<%=Enumeration.fromItems(jobSubtypesQuery.list(dc), "-none-")%>"
278        title="Job type"
279        sortable="true" 
280        filterable="true"
281        exportable="true"
282      />
283      <tbl:columndef 
284        id="plugin"
285        property="job.pluginDefinition.name"
286        datatype="string"
287        title="Plugin"
288        sortable="true" 
289        filterable="true"
290        exportable="true"
291      />
292      <tbl:columndef 
293        id="protocol"
294        property="protocol.name"
295        datatype="string"
296        title="Protocol"
297        sortable="true" 
298        filterable="true"
299        exportable="true"
300      />
301      <tbl:columndef 
302        id="kit"
303        property="kit.name"
304        datatype="string"
305        title="Kit"
306        sortable="true" 
307        filterable="true"
308        exportable="true"
309      />
310      <tbl:columndef
311        id="hardware"
312        property="hardware.name"
313        datatype="string"
314        title="Hardware"
315        sortable="true"
316        filterable="true"
317        exportable="true"
318      />
319      <tbl:columndef
320        id="software"
321        property="software.name"
322        datatype="string"
323        title="Software"
324        sortable="true"
325        filterable="true"
326        exportable="true"
327      />
328      <tbl:columndef 
329        id="entryDate"
330        property="entryDate"
331        datatype="date"
332        title="Registered"
333        sortable="true" 
334        filterable="true"
335        exportable="true"
336        formatter="<%=dateFormatter%>"
337      />
338      <tbl:columndef 
339        id="owner"
340        property="owner.name"
341        datatype="string"
342        title="Owner"
343        sortable="true" 
344        filterable="true"
345        exportable="true"
346      />
347      <tbl:columndef 
348        id="description"
349        property="description"
350        datatype="string"
351        title="Description" 
352        sortable="true" 
353        filterable="true" 
354        exportable="true"
355      />
356      <tbl:columndef
357        id="itemList"
358        property="§itemLists"
359        datatype="int"
360        title="Item list"
361        filterable="true"
362        enumeration="<%=Base.getItemListsEnum(dc, itemType, cc.getInclude())%>"
363        multiple="false"
364      />
365      <%
366      for (AnnotationLoaderUtil loader : annotationLoaders)
367      {
368        AnnotationType at = loader.getAnnotationType();
369        Formatter<Object> formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType());
370        Enumeration<String, String> annotationEnum = null;
371        if (at.isEnumeration())
372        {
373          annotationEnum = new Enumeration<String, String>();
374          if (!at.getDisplayAsList()) annotationEnum.add("", "-none-");
375          List<?> values = at.getValues();
376          for (Object value : values)
377          {
378            String encoded = formatter.format(value);
379            annotationEnum.add(encoded, encoded);
380          }
381        }
382        %>
383        <tbl:columndef 
384          subclass="controlled-width"
385          id="<%=(loader.isSearchingInheritedAnnotations() ? "ia" : "at")+at.getId()%>"
386          title="<%=HTML.encodeTags(at.getName())+(loader.isSearchingInheritedAnnotations() ? " [I]" : " [A]")%>" 
387          property="<%=(loader.isSearchingInheritedAnnotations() ? "##" : "#")+at.getId()%>"
388          annotation="true"
389          datatype="<%=at.getValueType().getStringValue()%>"
390          enumeration="<%=annotationEnum%>"
391          smartenum="<%=at.getDisplayAsList() %>"
392          sortable="<%=at.getMultiplicity() == 1 && !loader.isSearchingInheritedAnnotations()%>" 
393          filterable="true" 
394          exportable="true"
395          formatter="<%=formatter%>"
396          unit="<%=at.getDefaultUnit()%>"
397        />
398        <%
399      }
400      for (DataFileType ft : fileTypeColumns)
401      {
402        %>
403        <tbl:columndef
404          subclass="controlled-width"
405          id="<%="ft"+ft.getId()%>"
406          title="<%=HTML.encodeTags(ft.getName())+" [F]"%>"
407          property="<%="¤" + ft.getId()+"(file.name)"%>"
408          exportproperty="<%="¤" + ft.getId()+"(file.path)"%>"
409          datatype="string"
410          filterable="true"
411          sortable="false"
412          exportable="true"
413          formatter="<%=new DataFileFormatter(dc, ft, mode) %>"
414        />
415        <%
416      }
417      %>
418      <tbl:columndef
419        id="permission"
420        title="Permission"
421      />
422      <tbl:columndef
423        id="sharedTo"
424        title="Shared to"
425        filterable="true"
426        filterproperty="!sharedTo.name"
427        datatype="string"
428      />
429      <tbl:columndef 
430        id="xt-columns" 
431        extensions="<%=columnsInvoker%>" 
432        jspcontext="<%=jspContext%>" 
433      />
434      <div class="panelgroup bg-filled-50 bottomborder">
435        <tbl:toolbar
436          subclass="bottomborder"
437          visible="<%=mode.hasToolbar()%>"
438          >
439          <tbl:button 
440            id="btnNewItem"
441            disabled="<%=!createPermission%>" 
442            image="new.png" 
443            title="New&hellip;" 
444            tooltip="<%=createPermission ? "Create new derived bioassay" : "You do not have permission to create derived bioassays"%>" 
445          />
446          <tbl:button 
447            id="btnNewMergedDerivedBioAssay"
448            disabled="<%=!createPermission%>" 
449            image="new_pooled.png" 
450            title="Merge&hellip;" 
451            tooltip="<%=createPermission ? "Create new merged bioassay" : "You do not have permission to create derived bioassay"%>" 
452          />
453          <tbl:button 
454            id="btnDeleteItems"
455            image="delete.png"
456            title="Delete" 
457            tooltip="Delete the selected items" 
458          />
459          <tbl:button 
460            id="btnRestoreItems"
461            image="restore.png"
462            title="Restore" 
463            tooltip="Restore the selected (deleted) items"
464          />
465          <tbl:button 
466            id="btnShareItems"
467            image="share.png"
468            title="Share&hellip;" 
469            tooltip="Share the selected items"
470          />
471          <tbl:button 
472            id="btnSetOwner"
473            image="take_ownership.png"
474            title="Set owner&hellip;"
475            tooltip="Change owner of the selected items"
476          />
477          <tbl:button 
478            id="btnColumns"
479            image="columns.png" 
480            title="Columns&hellip;" 
481            tooltip="Show, hide and re-order columns" 
482          />
483          <tbl:button
484            id="btnNewItemList"
485            image="add.png"
486            title="New item list&hellip;"
487            tooltip="Create a new item list from matching bioassays"
488            visible="<%=sc.hasPermission(Permission.CREATE, Item.ITEMLIST)%>"
489          />
490          <tbl:button
491            id="btnInheritAnnotations"
492            image="inherit.png"
493            title="Inherit annotations&hellip;"
494            tooltip="Batch inherit annotations from parent items"
495          />
496          <tbl:button 
497            id="btnImport"
498            data-plugin-type="IMPORT"
499            image="import.png" 
500            title="Import&hellip;" 
501            tooltip="Import data" 
502            visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
503          />
504          <tbl:button 
505            id="btnExport"
506            data-plugin-type="EXPORT"
507            image="export.png" 
508            title="Export&hellip;" 
509            tooltip="Export data" 
510            visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
511          />
512          <tbl:button 
513            id="btnRunPlugin"
514            data-plugin-type="OTHER"
515            image="runplugin.png" 
516            title="Run plugin&hellip;" 
517            tooltip="Run a plugin" 
518            visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
519          />
520          <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
521            wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/>
522        </tbl:toolbar>
523        <tbl:panel>
524          <tbl:presetselector />
525          <tbl:navigator
526            page="<%=cc.getPage()%>" 
527            rowsperpage="<%=cc.getRowsPerPage()%>" 
528            totalrows="<%=bioAssays == null ? 0 : bioAssays.getTotalCount()%>" 
529            visible="<%=mode.hasNavigator()%>"
530          />
531        </tbl:panel>
532      </div>
533      <tbl:data>
534        <tbl:headers>
535          <tbl:headerrow>
536            <tbl:header colspan="3" />
537            <tbl:columnheaders />
538          </tbl:headerrow>
539          <%
540          int numFilters = cc.getNumPropertyFilters();
541          int numRows = cc.getFilterRows();
542          for (int filterNo = 0; filterNo < numRows; filterNo++)
543          {
544            boolean lastRow = filterNo == numRows-1;
545            %>
546            <tbl:headerrow>
547              <tbl:header subclass="index" />
548              <tbl:header 
549                subclass="check" 
550                visible="<%=mode.hasCheck()%>"
551                ><base:icon 
552                  subclass="link table-check"
553                  image="check_uncheck.png" 
554                  tooltip="Toggle all (use CTRL, ALT or SHIFT to check/uncheck)" 
555                  visible="<%=lastRow%>"
556                /></tbl:header>
557              <tbl:header 
558                subclass="check" 
559                visible="<%=mode.hasRadio()%>"
560                />
561              <tbl:header 
562                subclass="icons" 
563                visible="<%=mode.hasIcons()%>"
564                >
565                <base:icon
566                  subclass="link table-filter-row-action"
567                  image="add.png"
568                  tooltip="Add extra filter row"
569                  visible="<%=lastRow%>"
570                /><base:icon
571                  subclass="link table-filter-row-action"
572                  image="remove.png"
573                  tooltip="Remove this filter row"
574                  visible="<%=numRows > 1 || numFilters > 0 %>"
575                  data-remove-row="<%=filterNo%>"
576                />
577              </tbl:header>
578              <tbl:propertyfilter row="<%=filterNo%>" />
579            </tbl:headerrow>
580            <%
581          }
582          %>
583        </tbl:headers>
584        <tbl:rows>
585          <%
586          if (cc.getMessage() != null)
587          {
588            %>
589            <tbl:panel subclass="bg-filled-50">
590              <div class="messagecontainer error"><%=cc.getMessage()%></div>
591            </tbl:panel>
592            <%
593            cc.setMessage(null);
594          }
595          int index = cc.getPage()*cc.getRowsPerPage();
596          int selectedItemId = cc.getId();
597          if (bioAssays != null)
598          {           
599            while (bioAssays.hasNext())
600            {
601              DerivedBioAssay item = bioAssays.next();
602              int itemId = item.getId();
603              boolean usePermission = item.hasPermission(Permission.USE);
604             
605             
606              boolean deletePermission = item.hasPermission(Permission.DELETE);
607              boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION);
608              boolean writePermission = item.hasPermission(Permission.WRITE);
609              String tooltip = mode.isSelectionMode() ? 
610                  "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : "");
611              String name = HTML.encodeTags(item.getName());
612              index++;
613              numListed++;
614              %>
615              <tbl:row>
616                <tbl:header 
617                  clazz="index"
618                  ><%=index%></tbl:header>
619                <tbl:header 
620                  clazz="check" 
621                  visible="<%=mode.hasCheck()%>"
622                  ><input 
623                    type="checkbox" 
624                    name="<%=itemId%>" 
625                    value="<%=itemId%>" 
626                    title="<%=name%>" 
627                    <%=cc.getSelected().contains(itemId) ? "checked" : ""%> 
628                  ></tbl:header>
629                <tbl:header 
630                  clazz="check" 
631                  visible="<%=mode.hasRadio()%>"
632                  ><input 
633                    type="radio" 
634                    name="item_id" 
635                    value="<%=itemId%>" 
636                    title="<%=name%>" 
637                    <%=selectedItemId == itemId ? "checked" : ""%>
638                  ></tbl:header>
639                <tbl:header 
640                  clazz="icons" 
641                  visible="<%=mode.hasIcons()%>"
642                  ><base:icon 
643                    image="deleted.png"
644                    id="<%="delete."+itemId %>"
645                    subclass="<%=deletePermission ? "table-delete-item" : "disabled" %>"
646                    data-item-id="<%=itemId%>"
647                    tooltip="This item has been scheduled for deletion" 
648                    visible="<%=item.isRemoved()%>"
649                  /><base:icon 
650                    image="shared.png" 
651                    id="<%="share."+itemId %>"
652                    subclass="<%=sharePermission ? "table-share-item" : "disabled" %>"
653                    data-item-id="<%=itemId%>"
654                    tooltip="This item is shared to other users, groups and/or projects" 
655                    visible="<%=item.isShared()%>"
656                  />&nbsp;</tbl:header>
657                <tbl:cell column="name"><div 
658                  class="link table-item"
659                  data-item-id="<%=itemId%>"
660                  data-no-edit="<%=writePermission ? 0 : 1 %>" 
661                  tabindex="0"
662                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
663                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
664                <tbl:cell column="itemSubtype"><base:propertyvalue 
665                    item="<%=item%>" 
666                    property="itemSubtype"
667                    enableEditLink="<%=mode.hasEditLink()%>" 
668                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
669                  /></tbl:cell>
670                <tbl:cell column="children">
671                  <%
672                  childQuery.setParameter("bioAssay", itemId, Type.INT);
673                  try
674                  {
675                    String separator = "";
676                    for (DerivedBioAssay child : childQuery.list(dc))
677                    {
678                      out.write(separator);
679                      if (mode.hasPropertyLink())
680                      {
681                        out.write(Base.getLinkedName(ID, child, false, mode.hasEditLink()));
682                      }
683                      else
684                      {
685                        out.write(HTML.encodeTags(child.getName()));
686                      }
687                      separator = ", ";
688                    }
689                  }
690                  catch (Throwable t)
691                  {
692                    %>
693                    <div class="error"><%=t.getMessage()%></div>
694                    <%
695                  }
696                  %>             
697                  <base:icon
698                    subclass="link auto-init"
699                    data-auto-init="new-child-bioassay"
700                    data-item-id="<%=itemId %>"
701                    image="add.png" 
702                    tooltip="Create new child bioassay" 
703                    visible="<%=mode.hasEditLink() && createPermission && usePermission %>"
704                  />
705                </tbl:cell>
706                <tbl:cell column="rawBioAssays">
707                  <%
708                  rawBioAssayQuery.setParameter("bioAssay", itemId, Type.INT);
709                  try
710                  {
711                    String separator = "";
712                    for (RawBioAssay rba : rawBioAssayQuery.list(dc))
713                    {
714                      out.write(separator);
715                      if (mode.hasPropertyLink())
716                      {
717                        out.write(Base.getLinkedName(ID, rba, false, mode.hasEditLink()));
718                      }
719                      else
720                      {
721                        out.write(HTML.encodeTags(rba.getName()));
722                      }
723                      separator = ", ";
724                    }
725                  }
726                  catch (Throwable t)
727                  {
728                    %>
729                    <div class="error"><%=t.getMessage()%></div>
730                    <%
731                  }
732                  %>             
733                  <base:icon
734                    subclass="link auto-init"
735                    data-auto-init="new-raw-bioassay"
736                    data-item-id="<%=itemId %>"
737                    image="add.png" 
738                    tooltip="Create new raw bioassay" 
739                    visible="<%=mode.hasEditLink() && createRawBioAssayPermission && usePermission %>"
740                  />
741                </tbl:cell>
742                <tbl:cell column="physicalBioAssays">
743                  <%
744                  physicalBioAssayQuery.setParameter("bioAssay", itemId, Type.INT);
745                  try
746                  {
747                    String separator = "";
748                    for (PhysicalBioAssay pba : physicalBioAssayQuery.list(dc))
749                    {
750                      out.write(separator);
751                      if (mode.hasPropertyLink())
752                      {
753                        out.write(Base.getLinkedName(ID, pba, false, mode.hasEditLink()));
754                      }
755                      else
756                      {
757                        out.write(HTML.encodeTags(pba.getName()));
758                      }
759                      separator = ", ";
760                    }
761                  }
762                  catch (Throwable t)
763                  {
764                    %>
765                    <div class="error"><%=t.getMessage()%></div>
766                    <%
767                  }
768                  %>             
769                </tbl:cell>
770                <tbl:cell column="parents">
771                  <%
772                  if (!item.isRoot())
773                  {
774                    parentQuery.setParameter("bioAssay", itemId, Type.INT);
775                    try
776                    {
777                      String separator = "";
778                      for (DerivedBioAssay dba : parentQuery.list(dc))
779                      {
780                        out.write(separator);
781                        if (mode.hasPropertyLink())
782                        {
783                          out.write(Base.getLinkedName(ID, dba, false, mode.hasEditLink()));
784                        }
785                        else
786                        {
787                          out.write(HTML.encodeTags(dba.getName()));
788                        }
789                        separator = ", ";
790                      }
791                    }
792                    catch (Throwable t)
793                    {
794                      %>
795                      <div class="error"><%=t.getMessage()%></div>
796                      <%
797                    }
798                  }
799                  %>             
800                </tbl:cell>
801                <tbl:cell column="extract"
802                  ><base:propertyvalue 
803                    item="<%=item%>" 
804                    property="extract"
805                    enableEditLink="<%=mode.hasEditLink()%>" 
806                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
807                  /></tbl:cell>
808                <tbl:cell column="jobType"><base:propertyvalue 
809                    item="<%=item%>" 
810                    property="job.itemSubtype"
811                    enableEditLink="<%=mode.hasEditLink()%>" 
812                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
813                  /></tbl:cell>
814                <tbl:cell column="plugin"
815                  ><base:propertyvalue 
816                    item="<%=item%>" 
817                    property="job.pluginDefinition"
818                    enableEditLink="<%=mode.hasEditLink()%>" 
819                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
820                  /></tbl:cell>
821                <tbl:cell column="protocol"
822                  ><base:propertyvalue 
823                    item="<%=item%>" 
824                    property="protocol"
825                    enableEditLink="<%=mode.hasEditLink()%>" 
826                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
827                  /></tbl:cell>
828                <tbl:cell column="kit"
829                  ><base:propertyvalue 
830                    item="<%=item%>" 
831                    property="kit"
832                    enableEditLink="<%=mode.hasEditLink()%>" 
833                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
834                  /></tbl:cell>
835                <tbl:cell column="hardware"
836                  ><base:propertyvalue 
837                    item="<%=item%>"
838                    property="hardware"
839                    enableEditLink="<%=mode.hasEditLink()%>" 
840                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
841                  /></tbl:cell>
842                <tbl:cell column="software"
843                  ><base:propertyvalue 
844                    item="<%=item%>"
845                    property="software"
846                    enableEditLink="<%=mode.hasEditLink()%>" 
847                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
848                  /></tbl:cell>
849                <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" />
850                <tbl:cell column="owner"
851                  ><base:propertyvalue 
852                    item="<%=item%>" 
853                    property="owner"
854                    enableEditLink="<%=mode.hasEditLink()%>" 
855                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
856                  /></tbl:cell>
857                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
858                <%
859                if (item.hasFileSet())
860                {
861                  FileSet fileSet = item.getFileSet();
862                  for (DataFileType ft : fileTypeColumns)
863                  {
864                    %>
865                    <tbl:cell column="<%="ft"+ft.getId()%>" value="<%=fileSet%>" />
866                    <%
867                  }
868                }
869                if (item.isAnnotated())
870                {
871                  AnnotationSetSnapshot snapshot = manager.getSnapshot(dc, item.getAnnotationSet().getId());
872                  for (AnnotationLoaderUtil loader : annotationLoaders)
873                  {
874                    %>
875                    <tbl:cell 
876                      column="<%=(loader.isSearchingInheritedAnnotations() ? "ia" : "at")+loader.getId()%>"
877                      ><%
878                      if (loader.find(snapshot, psInfo.reset())) 
879                      {
880                        %><tbl:cellvalue 
881                          list="<%=loader.getValues()%>"
882                          suffix="<%=loader.getUnitSymbol()%>"
883                          clazz="<%=psInfo.overridesDefaultAnnotation() ? "ps-annotation" : null%>"
884                        /><%
885                      }
886                      %></tbl:cell>
887                    <%
888                  }
889                }
890                %>
891                <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell>
892                <tbl:cell column="sharedTo">
893                  <%
894                  Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator();
895                  while(sharees.hasNext())
896                  {
897                    Nameable n = sharees.next();
898                    if (mode.hasPropertyLink())
899                    {
900                      out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink()));
901                    }
902                    else
903                    {
904                      out.write(HTML.encodeTags(n.getName()));
905                    }
906                    out.write(sharees.hasNext() ? ", " : "");
907                  }
908                  %>
909                </tbl:cell>
910                <tbl:xt-cells dc="<%=dc%>" item="<%=item%>">
911                  <tbl:cell column="xt-columns" />
912                </tbl:xt-cells>
913              </tbl:row>
914              <%
915              }
916            }
917          if (numListed == 0)
918          {
919            %>
920            <tbl:panel subclass="bg-filled-50">
921              <div class="messagecontainer note">
922              <%=bioAssays == null || bioAssays.getTotalCount() == 0 ? "No bioassays were found" : "No bioassays on this page. Please select another page!" %>
923              </div>
924            </tbl:panel>
925            <%
926          }
927          %>
928        </tbl:rows>
929      </tbl:data>
930    </tbl:table>
931    </div>
932   
933    <base:buttongroup subclass="dialogbuttons">
934      <base:button id="btnOk" title="Ok" visible="<%=mode.hasOkButton()%>" />
935      <base:button id="close" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
936      <base:button id="close" title="Close" visible="<%=mode.hasCloseButton()%>" />
937    </base:buttongroup>
938   
939  </base:body>
940  </base:page>
941  <%
942}
943finally
944{
945  if (bioAssays != null) bioAssays.close();
946  if (dc != null) dc.close();
947}
948%>
Note: See TracBrowser for help on using the repository browser.