source: trunk/www/lims/arraydesigns/list_designs.jsp @ 5674

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

Fixes #1611: Checkbox enabled lists for enumerated annotations

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