source: trunk/www/views/rawbioassays/list_rawbioassays.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: 26.9 KB
Line 
1<%-- $Id: list_rawbioassays.jsp 5674 2011-06-27 12:29:52Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
5  Copyright (C) 2007 Johan Enell, Martin Svensson
6
7  This file is part of BASE - BioArray Software Environment.
8  Available at http://base.thep.lu.se/
9
10  BASE is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License
12  as published by the Free Software Foundation; either version 3
13  of the License, or (at your option) any later version.
14
15  BASE is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with BASE. If not, see <http://www.gnu.org/licenses/>.
22  ------------------------------------------------------------------
23
24  @author Nicklas
25  @version 2.0
26--%>
27<%@ page pageEncoding="UTF-8" session="false"
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.Item"
31  import="net.sf.basedb.core.RawBioAssay"
32  import="net.sf.basedb.core.Platform"
33  import="net.sf.basedb.core.RawDataType"
34  import="net.sf.basedb.core.RawDataTypes"
35  import="net.sf.basedb.core.Experiment"
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.File"
40  import="net.sf.basedb.core.FileSetMember"
41  import="net.sf.basedb.core.ItemQuery"
42  import="net.sf.basedb.core.Include"
43  import="net.sf.basedb.core.Type"
44  import="net.sf.basedb.core.ItemResultIterator"
45  import="net.sf.basedb.core.ItemResultList"
46  import="net.sf.basedb.core.ItemContext"
47  import="net.sf.basedb.core.Job"
48  import="net.sf.basedb.core.Nameable"
49  import="net.sf.basedb.core.Permission"
50  import="net.sf.basedb.core.PluginDefinition"
51  import="net.sf.basedb.core.PermissionDeniedException"
52  import="net.sf.basedb.core.Quantity"
53  import="net.sf.basedb.core.Unit"
54  import="net.sf.basedb.core.query.Hql"
55  import="net.sf.basedb.core.query.Restrictions"
56  import="net.sf.basedb.core.query.Expressions"
57  import="net.sf.basedb.core.query.Orders"
58  import="net.sf.basedb.core.plugin.GuiContext"
59  import="net.sf.basedb.core.plugin.Plugin"
60  import="net.sf.basedb.util.Enumeration"
61  import="net.sf.basedb.util.ShareableUtil"
62  import="net.sf.basedb.util.formatter.Formatter"
63  import="net.sf.basedb.util.units.UnitUtil"
64  import="net.sf.basedb.clients.web.Base"
65  import="net.sf.basedb.clients.web.ModeInfo"
66  import="net.sf.basedb.clients.web.PermissionUtil"
67  import="net.sf.basedb.clients.web.util.HTML"
68  import="net.sf.basedb.util.Values"
69  import="net.sf.basedb.util.formatter.Formatter"
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.ToolbarUtil"
75  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
76  import="java.util.Iterator"
77  import="java.util.List"
78  import="java.util.Map"
79  import="java.util.Date"
80%>
81<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
82<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
83<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
84<%!
85  private static final Item itemType = Item.RAWBIOASSAY;
86  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.LIST);
87%>
88<%
89final String root = request.getContextPath()+"/";
90final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType);
91final String ID = sc.getId();
92final boolean createPermission = sc.hasPermission(Permission.CREATE, itemType);
93final boolean readPermission = sc.hasPermission(Permission.READ, itemType);
94final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
95
96final ModeInfo mode = ModeInfo.get(request.getParameter("mode"));
97final String callback = request.getParameter("callback");
98final String title = mode.generateTitle("raw bioassay", "raw bioassays");
99final DbControl dc = sc.newDbControl();
100ItemResultIterator<RawBioAssay> rawBioAssays = null;
101ItemResultList<AnnotationType> annotationTypes = null;
102try
103{
104  final ItemQuery<AnnotationType> annotationTypeQuery = Base.getAnnotationTypesQuery(itemType);
105
106  // Query for experiments relatated to the current raw bioassay
107  final ItemQuery<Experiment> experimentQuery = Experiment.getQuery();
108  experimentQuery.include(cc.getInclude());
109  experimentQuery.join(Hql.innerJoin("rawBioAssays", "rba"));
110  experimentQuery.restrict(Restrictions.eq(Hql.alias("rba"), Expressions.parameter("rawBioAssay")));
111  experimentQuery.order(Orders.asc(Hql.property("name"))); 
112 
113  // Get all platforms
114  final ItemQuery<Platform> platformQuery = Platform.getQuery();
115  platformQuery.include(cc.getInclude());
116  platformQuery.order(Orders.asc(Hql.property("name")));
117  platformQuery.setCacheResult(true);
118  Enumeration<String, String> platforms = new Enumeration<String, String>();
119  for (Platform p : platformQuery.list(dc))
120  {
121    platforms.add(Integer.toString(p.getId()), p.getName());
122  }
123 
124  Unit bytes = UnitUtil.getUnit(dc, Quantity.STORAGE_SIZE, "B");
125  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
126  annotationTypes = annotationTypeQuery.list(dc);
127  try
128  {
129    final ItemQuery<RawBioAssay> query = Base.getConfiguredQuery(dc, cc, true, RawBioAssay.getQuery(), mode);
130    rawBioAssays = query.iterate(dc);
131  }
132  catch (Throwable t)
133  {
134    t.printStackTrace();
135    cc.setMessage(t.getMessage());
136  }
137  Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc);
138  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
139  int numListed = 0;
140  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, null);
141  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
142  %>
143  <base:page title="<%=title==null ? "Raw bioassays" : title%>" type="<%=mode.getPageType()%>">
144  <base:head scripts="menu.js,table.js" styles="menu.css,table.css">
145    <ext:scripts context="<%=jspContext%>" />
146    <ext:stylesheets context="<%=jspContext%>" />
147    <script language="JavaScript">
148    var submitPage = 'index.jsp';
149    var formId = 'rawbioassays';
150    function newItem()
151    {
152      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', 0, true);
153    }
154    function editItem(itemId)
155    {
156      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
157    }
158    function viewItem(itemId)
159    {
160      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, false);
161    }
162    function itemOnClick(evt, itemId)
163    {
164      Table.itemOnClick(formId, evt, itemId, '<%=mode.getName()%>', viewItem, editItem, returnSelected);
165    }
166    function deleteItems()
167    {
168      var frm = document.forms[formId];
169      if (Forms.numChecked(frm) == 0)
170      {
171        alert('Please select at least one item in the list');
172        return;
173      }
174      frm.action = submitPage;
175      frm.cmd.value = 'DeleteItems';
176      frm.submit();
177    }
178    function restoreItems()
179    {
180      var frm = document.forms[formId];
181      if (Forms.numChecked(frm) == 0)
182      {
183        alert('Please select at least one item in the list');
184        return;
185      }
186      frm.action = submitPage;
187      frm.cmd.value = 'RestoreItems';
188      frm.submit();
189    }
190    function deleteItemPermanently(itemId)
191    {
192      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', itemId);
193    }
194    function setOwner()
195    {
196      Table.setOwnerOfItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'SetOwnerOfItems');
197    }
198    function shareItem(itemId)
199    {
200      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id='+itemId, 'ShareRawBioAssay', 600, 400);
201    }
202    function shareItems()
203    {
204      Table.shareItems(submitPage, '<%=ID%>', formId, '<%=itemType.name()%>', 'ShareItems');
205    }
206    function configureColumns()
207    {
208      Table.configureColumns('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>');
209    }
210    function runPlugin(cmd)
211    {
212      Table.submitToPopup(formId, cmd, 740, 540);
213    }
214    function returnSelected()
215    {
216      Table.returnSelected(formId, <%=callback != null ? "window.opener."+callback : "null" %>);
217      window.close();
218    }
219    function presetOnChange()
220    {
221      Table.presetOnChange('<%=ID%>', formId, '<%=itemType.name()%>', '<%=(String)cc.getObject("defaultColumns")%>');
222    }
223    function newExperiment()
224    {
225      var frm = document.forms[formId];
226      var selected = Table.getSelected(formId);
227      if (selected.length == 0)
228      {
229        alert('Please select at least one item in the list');
230        return;
231      }
232      var extraUrl = '&rawbioassay_id='+selected.join('&rawbioassay_id=');
233      Main.viewOrEditItem('<%=ID%>', 'EXPERIMENT', 0, true, extraUrl);
234    }
235    </script>
236  </base:head>
237 
238  <base:body>
239    <%
240    if (cc.getMessage() != null)
241    {
242      %>
243      <div class="error"><%=cc.getMessage()%></div>
244      <%
245      cc.setMessage(null);
246    }
247    %>
248    <tbl:table 
249      id="rawbioassays" 
250      clazz="itemlist" 
251      columns="<%=cc.getSetting("columns")%>"
252      sortby="<%=cc.getSortProperty()%>" 
253      direction="<%=cc.getSortDirection()%>"
254      title="<%=title%>"
255      action="index.jsp"
256      sc="<%=sc%>"
257      item="<%=itemType%>"
258      >
259      <tbl:hidden 
260        name="mode" 
261        value="<%=mode.getName()%>" 
262      />
263      <tbl:hidden 
264        name="callback" 
265        value="<%=callback%>" 
266        skip="<%=callback == null%>" 
267      />
268      <tbl:columndef 
269        id="name"
270        property="name"
271        datatype="string"
272        title="Name"
273        sortable="true" 
274        filterable="true"
275        exportable="true"
276        show="always" 
277      />
278      <tbl:columndef 
279        id="id" 
280        clazz="uniquecol"
281        property="id"
282        datatype="int"
283        title="ID"
284        sortable="true"
285        filterable="true"
286        exportable="true"
287      />
288      <tbl:columndef 
289        id="entryDate"
290        property="entryDate"
291        datatype="date"
292        title="Registered"
293        sortable="true" 
294        filterable="true"
295        exportable="true"
296        formatter="<%=dateFormatter%>"
297      />
298      <tbl:columndef 
299        id="platform"
300        property="platform"
301        sortproperty="platform.name"
302        exportproperty="platform.name"
303        datatype="int"
304        enumeration="<%=platforms%>"
305        title="Platform"
306        sortable="true" 
307        filterable="true"
308        exportable="true"
309      /> 
310      <tbl:columndef 
311        id="variant"
312        property="variant.name"
313        datatype="string"
314        title="Variant"
315        sortable="true" 
316        filterable="true"
317        exportable="true"
318      />       
319      <%
320      Enumeration<String, String> rawEnumeration = new Enumeration<String, String>();
321      for (RawDataType rdt : RawDataTypes.getRawDataTypes())
322      {
323        rawEnumeration.add(rdt.getId(), HTML.encodeTags(rdt.getName()));
324      }
325      rawEnumeration.sortValues();
326      %>
327      <tbl:columndef 
328        id="rawDataType"
329        property="rawDataType"
330        datatype="string"
331        enumeration="<%=rawEnumeration%>"
332        title="Raw data type"
333        sortable="true" 
334        filterable="true"
335        exportable="true"
336      />
337      <tbl:columndef 
338        id="hasData"
339        property="hasData"
340        datatype="boolean"
341        title="Has data"
342        sortable="true" 
343        filterable="true"
344        exportable="true"
345      />
346      <tbl:columndef 
347        id="spots"
348        property="spots"
349        datatype="int"
350        title="Db spots"
351        sortable="true" 
352        filterable="true"
353        exportable="true"
354      />
355      <tbl:columndef 
356        id="numFileSpots"
357        property="numFileSpots"
358        datatype="int"
359        title="File spots"
360        sortable="true" 
361        filterable="true"
362        exportable="true"
363      />     
364      <tbl:columndef 
365        id="bytes"
366        property="bytes"
367        datatype="long"
368        title="Bytes"
369        sortable="true" 
370        filterable="true"
371        exportable="true"
372        unit="<%=bytes%>"
373      />
374      <tbl:columndef 
375        id="parent"
376        property="parent.name"
377        datatype="string"
378        title="Parent"
379        sortable="true" 
380        filterable="true"
381        exportable="true"
382      />
383      <tbl:columndef 
384        id="software"
385        property="software.name"
386        datatype="string"
387        title="Software"
388        sortable="true" 
389        filterable="true"
390        exportable="true"
391      />
392      <tbl:columndef 
393        id="protocol"
394        property="protocol.name"
395        datatype="string"
396        title="Protocol"
397        sortable="true" 
398        filterable="true"
399        exportable="true"
400      />
401      <tbl:columndef 
402        id="arrayDesign"
403        property="arrayDesign.name"
404        datatype="string"
405        title="Array design"
406        sortable="true" 
407        filterable="true"
408        exportable="true"
409      />
410      <tbl:columndef 
411        id="plugin"
412        property="job.pluginDefinition.name"
413        datatype="string"
414        title="Plugin"
415        sortable="true"
416        filterable="true"
417        exportable="true"
418        tooltip="The plug-in that was used to import raw data"
419      />
420      <tbl:columndef 
421        id="configuration"
422        property="job.pluginConfiguration.name"
423        datatype="string"
424        title="Configuration"
425        sortable="true"
426        filterable="true"
427        exportable="true" 
428        tooltip="The configuration/file format that was used to import raw data"
429      />
430      <tbl:columndef 
431        id="importdate"
432        property="job.ended"
433        datatype="date"
434        title="Import date"
435        sortable="true"
436        filterable="true"
437        exportable="true" 
438        tooltip="The date and time of the raw data import"
439        formatter="<%=dateTimeFormatter%>"
440      />
441      <tbl:columndef
442        id="experiments"
443        title="Experiments"
444        property="&experiments(name)"
445        datatype="string"
446        filterable="true"
447        exportable="true"
448      />
449      <tbl:columndef
450        id="files"
451        title="Files"
452        property="&fileSet.members(file.name)"
453        datatype="string"
454        filterable="true"
455        exportable="true"
456      />
457      <tbl:columndef 
458        id="owner"
459        property="owner.name"
460        datatype="string"
461        title="Owner"
462        sortable="true" 
463        filterable="true"
464        exportable="true"
465      />
466      <tbl:columndef 
467        id="description"
468        property="description"
469        datatype="string"
470        title="Description" 
471        sortable="true" 
472        filterable="true" 
473        exportable="true"
474      />
475      <%
476      for (AnnotationType at : annotationTypes)
477      {
478        Enumeration<String, String> annotationEnum = null;
479        if (at.isEnumeration())
480        {
481          annotationEnum = new Enumeration<String, String>();
482          List<?> values = at.getValues();
483          for (Object value : values)
484          {
485            String encoded = HTML.encodeTags(value.toString());
486            annotationEnum.add(encoded, encoded);
487          }
488        }
489        %>
490        <tbl:columndef 
491          id="<%="at"+at.getId()%>"
492          title="<%=HTML.encodeTags(at.getName())+" [A]"%>" 
493          property="<%="#"+at.getId()%>"
494          annotation="true"
495          datatype="<%=at.getValueType().getStringValue()%>"
496          enumeration="<%=annotationEnum%>"
497          smartenum="<%=at.getDisplayAsList() %>"
498          sortable="false" 
499          filterable="true" 
500          exportable="true"
501          unit="<%=at.getDefaultUnit()%>"
502        />
503        <%
504      }
505      %>
506      <tbl:columndef
507        id="permission"
508        title="Permission"
509      />
510      <tbl:columndef
511        id="sharedTo"
512        title="Shared to"
513        filterable="true"
514        filterproperty="!sharedTo.name"
515        datatype="string"
516      />
517      <tbl:toolbar
518        visible="<%=mode.hasToolbar()%>"
519        >
520        <tbl:button 
521          disabled="<%=createPermission ? false : true%>" 
522          image="<%=createPermission ? "new.gif" : "new_disabled.gif"%>" 
523          onclick="newItem()" 
524          title="New&hellip;" 
525          tooltip="<%=createPermission ? "Create new raw bioassay" : "You do not have permission to create raw bioassays"%>" 
526        />
527        <tbl:button 
528          image="delete.gif"
529          onclick="deleteItems()" 
530          title="Delete" 
531          tooltip="Delete the selected items" 
532        />
533        <tbl:button 
534          image="restore.gif"
535          onclick="restoreItems()" 
536          title="Restore" 
537          tooltip="Restore the selected (deleted) items"
538        />
539        <tbl:button 
540          image="share.gif"
541          onclick="shareItems()" 
542          title="Share&hellip;" 
543          tooltip="Share the selected items"
544        />
545        <tbl:button 
546          image="take_ownership.png"
547          onclick="setOwner()" 
548          title="Set owner&hellip;"
549          tooltip="Change owner of the selected items"
550        />
551        <tbl:button 
552          image="columns.gif" 
553          onclick="configureColumns()" 
554          title="Columns&hellip;" 
555          tooltip="Show, hide and re-order columns" 
556        />
557        <tbl:button
558          image="add.png"
559          onclick="newExperiment()"
560          title="New experiment&hellip;"
561          tooltip="Create a new experiment from the selected raw bioassays"
562          visible="<%=sc.hasPermission(Permission.CREATE, Item.EXPERIMENT)%>"
563        />
564        <tbl:button 
565          image="import.gif" 
566          onclick="runPlugin('ImportItems')" 
567          title="Import&hellip;" 
568          tooltip="Import data" 
569          visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
570        />
571        <tbl:button 
572          image="export.gif" 
573          onclick="runPlugin('ExportItems')" 
574          title="Export&hellip;" 
575          tooltip="Export data" 
576          visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
577        />
578        <tbl:button 
579          image="runplugin.gif" 
580          onclick="runPlugin('RunListPlugin')" 
581          title="Run plugin&hellip;" 
582          tooltip="Run a plugin" 
583          visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
584        />
585        <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
586          wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
587      </tbl:toolbar>
588      <tbl:navigator
589        page="<%=cc.getPage()%>" 
590        rowsperpage="<%=cc.getRowsPerPage()%>" 
591        totalrows="<%=rawBioAssays == null ? 0 : rawBioAssays.getTotalCount()%>" 
592        visible="<%=mode.hasNavigator()%>"
593      />
594      <tbl:data>
595        <tbl:columns>
596        <tbl:presetselector 
597          clazz="columnheader"
598          colspan="3"
599          onchange="presetOnChange()"
600        />
601        </tbl:columns>
602
603        <tr>
604          <tbl:header 
605            clazz="index"
606            >&nbsp;</tbl:header>
607          <tbl:header 
608            clazz="check" 
609            visible="<%=mode.hasCheck()%>"
610            ><base:icon 
611              image="check_uncheck.gif" 
612              tooltip="Check/uncheck all" 
613              onclick="Forms.checkUncheck(document.forms[formId])" style="align: left;"
614            /></tbl:header>
615          <tbl:header 
616            clazz="check" 
617            visible="<%=mode.hasRadio()%>"
618            >&nbsp;</tbl:header>
619          <tbl:header 
620            clazz="icons" 
621            visible="<%=mode.hasIcons()%>"
622            >&nbsp;</tbl:header>
623          <tbl:propertyfilter />
624        </tr>
625         
626          <tbl:rows>
627          <%
628          int index = cc.getPage()*cc.getRowsPerPage();
629          int selectedItemId = cc.getId();
630          if (rawBioAssays != null)
631          {           
632            while (rawBioAssays.hasNext())
633            {
634              RawBioAssay item = rawBioAssays.next();
635              Job job = null;
636              try
637              {
638                job = item.getJob();
639              }
640              catch (Throwable t)
641              {}
642              int itemId = item.getId();
643              String openSharePopup = "shareItem("+itemId+")";
644              String deletePermanently = "deleteItemPermanently("+itemId+")";
645              boolean deletePermission = item.hasPermission(Permission.DELETE);
646              boolean sharePermission = item.hasPermission(Permission.SET_PERMISSION);
647              boolean writePermission = item.hasPermission(Permission.WRITE);
648              String tooltip = mode.isSelectionMode() ? 
649                  "Select this item" : "View this item" + (writePermission ? " (use CTRL, ALT or SHIFT to edit)" : "");
650              String name = HTML.encodeTags(item.getName());
651              index++;
652              numListed++;
653              %>
654              <tbl:row>
655                <tbl:header 
656                  clazz="index"
657                  ><%=index%></tbl:header>
658                <tbl:header 
659                  clazz="check" 
660                  visible="<%=mode.hasCheck()%>"
661                  ><input 
662                    type="checkbox" 
663                    name="<%=itemId%>" 
664                    value="<%=itemId%>" 
665                    title="<%=name%>" 
666                    <%=cc.getSelected().contains(itemId) ? "checked" : ""%> 
667                  ></tbl:header>
668                <tbl:header 
669                  clazz="check" 
670                  visible="<%=mode.hasRadio()%>"
671                  ><input 
672                    type="radio" 
673                    name="item_id" 
674                    value="<%=itemId%>" 
675                    title="<%=name%>" 
676                    <%=selectedItemId == itemId ? "checked" : ""%>
677                  ></tbl:header>
678                <tbl:header 
679                  clazz="icons" 
680                  visible="<%=mode.hasIcons()%>"
681                  ><base:icon 
682                    image="<%=deletePermission ? "deleted.gif" : "deleted_disabled.gif"%>"
683                    onclick="<%=deletePermission ? deletePermanently : null%>"
684                    tooltip="This item has been scheduled for deletion" 
685                    visible="<%=item.isRemoved()%>"
686                  /><base:icon 
687                    image="<%=sharePermission ? "shared.gif" : "shared_disabled.gif"%>" 
688                    onclick="<%=sharePermission ? openSharePopup : null%>"
689                    tooltip="This item is shared to other users, groups and/or projects" 
690                    visible="<%=item.isShared()%>"
691                  />&nbsp;</tbl:header>
692                <tbl:cell column="name"><div class="link" 
693                  onclick="itemOnClick(<%=writePermission ? "event" : null%>, <%=itemId%>)" 
694                  title="<%=tooltip%>"><%=name%></div></tbl:cell>
695                <tbl:cell column="id"><%=item.getId()%></tbl:cell>
696                <tbl:cell column="entryDate" value="<%=item.getEntryDate()%>" />
697                <tbl:cell column="spots"><%=item.getNumDbSpots()%></tbl:cell>
698                <tbl:cell column="numFileSpots"><%=item.getNumFileSpots()%></tbl:cell>
699                <tbl:cell column="bytes"><%=Values.formatBytes(item.getBytes())%></tbl:cell>
700                <tbl:cell column="platform"
701                  ><base:propertyvalue 
702                    item="<%=item%>" 
703                    property="platform"
704                    enableEditLink="<%=mode.hasEditLink()%>" 
705                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
706                  /></tbl:cell>
707                <tbl:cell column="variant"
708                  ><base:propertyvalue 
709                    item="<%=item%>" 
710                    property="variant"
711                    enableEditLink="<%=mode.hasEditLink()%>" 
712                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
713                  /></tbl:cell>               
714                <tbl:cell column="rawDataType"><%=HTML.encodeTags(item.getRawDataType().getName())%></tbl:cell>
715                <tbl:cell column="hasData"><%=item.hasData()%></tbl:cell>
716                <tbl:cell column="parent"
717                  ><base:propertyvalue 
718                    item="<%=item%>" 
719                    property="parent"
720                    enableEditLink="<%=mode.hasEditLink()%>" 
721                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
722                  /></tbl:cell>
723                <tbl:cell column="software"
724                  ><base:propertyvalue 
725                    item="<%=item%>" 
726                    property="software"
727                    enableEditLink="<%=mode.hasEditLink()%>" 
728                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
729                  /></tbl:cell>
730                <tbl:cell column="protocol"
731                  ><base:propertyvalue 
732                    item="<%=item%>" 
733                    property="protocol"
734                    enableEditLink="<%=mode.hasEditLink()%>" 
735                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
736                  /></tbl:cell>
737                <tbl:cell column="arrayDesign"
738                  ><base:propertyvalue 
739                    item="<%=item%>" 
740                    property="arrayDesign"
741                    enableEditLink="<%=mode.hasEditLink()%>" 
742                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
743                  /></tbl:cell>
744                <tbl:cell column="plugin">
745                  <base:propertyvalue 
746                    item="<%=item%>"
747                    property="job.pluginDefinition" 
748                    enableEditLink="<%=mode.hasEditLink()%>" 
749                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
750                    />
751                </tbl:cell>
752                <tbl:cell column="configuration">
753                  <base:propertyvalue 
754                    item="<%=item%>"
755                    property="job.pluginConfiguration" 
756                    enableEditLink="<%=mode.hasEditLink()%>" 
757                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
758                  />
759                </tbl:cell>
760                <tbl:cell 
761                  column="importdate" 
762                  value="<%=job == null ? null : job.getEnded() %>" 
763                />
764                <tbl:cell column="files">
765                  <% 
766                  if (item.hasFileSet())
767                  {
768                    for (FileSetMember member : item.getFileSet().getMembers().list(dc))
769                    {
770                      try
771                      {
772                        %>
773                        <%=Base.getLinkedFile(ID, member.getFile(), false, true, true, root) %><br>
774                        <%
775                      }
776                      catch (PermissionDeniedException ex)
777                      {}
778                    }
779                  }
780                  else
781                  {
782                    %>
783                    <i>- none -</i>
784                    <%
785                  }
786                  %>
787                </tbl:cell>
788                <tbl:cell column="experiments">
789                  <%
790                  experimentQuery.setParameter("rawBioAssay", itemId, Type.INT);
791                  try
792                  {
793                    String separator = "";
794                    for (Experiment e : experimentQuery.list(dc))
795                    {
796                      out.write(separator);
797                      if (mode.hasPropertyLink())
798                      {
799                        out.write(Base.getLinkedName(ID, e, false, mode.hasEditLink()));
800                      }
801                      else
802                      {
803                        out.write(HTML.encodeTags(e.getName()));
804                      }
805                      separator = ", ";
806                    }
807                  }
808                  catch (Throwable t)
809                  {
810                    %>
811                    <div class="error"><%=t.getMessage()%></div>
812                    <%
813                  }
814                  %>
815                </tbl:cell>
816                <tbl:cell column="owner"
817                  ><base:propertyvalue 
818                    item="<%=item%>" 
819                    property="owner"
820                    enableEditLink="<%=mode.hasEditLink()%>" 
821                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
822                  /></tbl:cell>
823                <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
824                <%
825                AnnotationSet as = item.isAnnotated() ? item.getAnnotationSet() : null;
826                if (as != null)
827                {
828                  for (AnnotationType at : annotationTypes)
829                  {
830                    if (as.hasAnnotation(at))
831                    {
832                      Annotation a = as.getAnnotation(at);
833                      String suffix = a.getUnitSymbol(null);
834                      if (suffix != null) suffix = "&nbsp;" + suffix;
835                      %>
836                      <tbl:cell 
837                        column="<%="at"+at.getId()%>"
838                        ><tbl:cellvalue 
839                          list="<%=a.getValues(null)%>"
840                          suffix="<%=suffix%>"
841                      /></tbl:cell>
842                      <%
843                    }
844                  }
845                }
846                %>
847                <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell>
848                <tbl:cell column="sharedTo">
849                  <%
850                  Iterator<Nameable> sharees = ShareableUtil.getSharedTo(dc, item).iterator();
851                  while(sharees.hasNext())
852                  {
853                    Nameable n = sharees.next();
854                    if (mode.hasPropertyLink())
855                    {
856                      out.write(Base.getLinkedName(ID, n, false, mode.hasEditLink()));
857                    }
858                    else
859                    {
860                      out.write(HTML.encodeTags(n.getName()));
861                    }
862                    out.write(sharees.hasNext() ? ", " : "");
863                  }
864                  %>
865                </tbl:cell>
866              </tbl:row>
867              <%
868              }
869            }
870          %>
871          </tbl:rows>
872      </tbl:data>
873      <%
874      if (numListed == 0)
875      {
876        %>
877        <tbl:panel><%=rawBioAssays == null || rawBioAssays.getTotalCount() == 0 ? "No raw bioassays were found" : "No raw bioassays on this page. Please select another page!" %></tbl:panel>
878        <%
879      }
880      else
881      {
882        %>
883        <tbl:navigator
884          page="<%=cc.getPage()%>" 
885          rowsperpage="<%=cc.getRowsPerPage()%>" 
886          totalrows="<%=rawBioAssays == null ? 0 : rawBioAssays.getTotalCount()%>" 
887          visible="<%=mode.hasNavigator()%>"
888          locked="true"
889        />
890        <%
891      }
892      %>
893    </tbl:table>
894    <base:buttongroup align="center" clazz="fixedatbottom">
895      <base:button onclick="returnSelected();" title="Ok" visible="<%=mode.hasOkButton()%>" />
896      <base:button onclick="window.close();" title="Cancel" visible="<%=mode.hasCancelButton()%>" />
897      <base:button onclick="window.close();" title="Close" visible="<%=mode.hasCloseButton()%>" />
898    </base:buttongroup>
899    <br><br><br>
900  </base:body>
901  </base:page>
902  <%
903}
904finally
905{
906  if (rawBioAssays != null) rawBioAssays.close();
907  if (dc != null) dc.close();
908}
909%>
Note: See TracBrowser for help on using the repository browser.