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

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

Merge BASE 3.16.1 to the trunk.

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