source: trunk/www/lims/arrayslides/view_slide.jsp @ 5944

Last change on this file since 5944 was 5944, checked in by Nicklas Nordborg, 10 years ago

References #1655: GUI improvements

Array section of Array LIMS. This should complete the view pages for all items. Now, it is only the list pages left.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 13.1 KB
Line 
1<%-- $Id: view_slide.jsp 5944 2012-02-02 13:10:37Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
4  Copyright (C) 2007 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.SystemItems"
30  import="net.sf.basedb.core.Item"
31  import="net.sf.basedb.core.ItemContext"
32  import="net.sf.basedb.core.Permission"
33  import="net.sf.basedb.core.AnnotationType"
34  import="net.sf.basedb.core.AnnotationSet"
35  import="net.sf.basedb.core.PhysicalBioAssay"
36  import="net.sf.basedb.core.ArraySlide"
37  import="net.sf.basedb.core.ArrayBatch"
38  import="net.sf.basedb.core.ArrayDesign"
39  import="net.sf.basedb.core.User"
40  import="net.sf.basedb.core.Group"
41  import="net.sf.basedb.core.ItemQuery"
42  import="net.sf.basedb.core.Include"
43  import="net.sf.basedb.core.ItemResultList"
44  import="net.sf.basedb.core.ItemResultList"
45  import="net.sf.basedb.core.MultiPermissions"
46  import="net.sf.basedb.core.PermissionDeniedException"
47  import="net.sf.basedb.core.PluginDefinition"
48  import="net.sf.basedb.core.plugin.GuiContext"
49  import="net.sf.basedb.core.plugin.Plugin"
50  import="net.sf.basedb.core.Project"
51  import="net.sf.basedb.core.query.Orders"
52  import="net.sf.basedb.core.query.Hql"
53  import="net.sf.basedb.clients.web.Base"
54  import="net.sf.basedb.clients.web.ChangeHistoryUtil"
55  import="net.sf.basedb.clients.web.PermissionUtil"
56  import="net.sf.basedb.clients.web.util.HTML"
57  import="net.sf.basedb.util.Values"
58  import="net.sf.basedb.util.formatter.Formatter"
59  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
60  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
61  import="net.sf.basedb.clients.web.extensions.JspContext"
62  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
63  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
64  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
65  import="java.util.Collections"
66  import="java.util.Date"
67  import="java.util.Map"
68  import="java.util.Set"
69  import="java.util.List"
70%>
71<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
72<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
73<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
74<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
75<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
76<%!
77  private static final Item itemType = Item.ARRAYSLIDE;
78  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
79%>
80<%
81final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
82final String ID = sc.getId();
83final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
84final int itemId = cc.getId();
85final String tab = Values.getString(request.getParameter("tab"), "properties");
86final float scale = Base.getScale(sc);
87final DbControl dc = sc.newDbControl();
88try
89{
90  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
91  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
92
93  String title = null;
94  ArraySlide slide = ArraySlide.getById(dc, itemId);
95 
96  final boolean writePermission = slide.hasPermission(Permission.WRITE);
97  final boolean deletePermission = slide.hasPermission(Permission.DELETE);
98  final boolean sharePermission = slide.hasPermission(Permission.SET_PERMISSION);
99  final boolean setOwnerPermission = slide.hasPermission(Permission.SET_OWNER);
100  final boolean isRemoved = slide.isRemoved();
101  final boolean isUsed = isRemoved && slide.isUsed();
102  final boolean deletePermanentlyPermission = deletePermission && !isUsed;
103  final boolean isOwner = slide.isOwner();
104  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, slide);
105  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
106  %>
107  <base:page title="<%=title%>">
108  <base:head scripts="tabcontrol.js,table.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
109    <ext:scripts context="<%=jspContext%>" />
110    <ext:stylesheets context="<%=jspContext%>" />
111    <script language="JavaScript">
112    function editItem()
113    {
114      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
115    }
116    function shareItem()
117    {
118      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareArraySlide', 600, 400);
119    }
120    function deleteItem()
121    {
122      location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');
123    }
124    function restoreItem()
125    {
126      location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');
127    }
128    function deleteItemPermanently()
129    {
130      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');
131    }
132    function itemDeleted()
133    {
134      Main.listItems('<%=ID%>', '<%=itemType.name()%>');
135    }
136    function showUsingItems()
137    {
138      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
139    }
140    function setOwner()
141    {
142      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300);
143    }
144    function runPlugin(cmd)
145    {
146      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);
147    }
148    function switchTab(tabControlId, tabId)
149    {
150      if (TabControl.isActive(tabControlId, tabId)) return;
151      if ((tabId == 'overview' || tabId == 'history') && tabId != '<%=tab%>')
152      {
153        location.href = 'index.jsp?ID=<%=ID%>&cmd=ViewItem&item_id=<%=itemId%>&tab='+tabId;
154      }
155      else
156      {
157        TabControl.setActiveTab(tabControlId, tabId);
158      }
159    }
160    </script>
161  </base:head>
162  <base:body>
163    <p:path><p:pathelement 
164      title="Array slides" href="<%="index.jsp?ID="+ID%>" 
165      /><p:pathelement title="<%=HTML.encodeTags(slide.getName())%>" 
166      /></p:path>
167   
168    <t:tabcontrol 
169      id="main" 
170      subclass="content mastertabcontrol" 
171      active="<%=tab%>" switch="switchTab" remember="false">
172    <t:tab id="properties" title="Properties">
173      <div>
174      <table class="fullform bottomborder">
175      <tr>
176        <th class="itemstatus">
177          <base:icon 
178            image="shared.gif" 
179            visible="<%=slide.isShared()%>"
180            tooltip="This item is shared to other users, groups and/or projects"
181          />
182          <base:icon 
183            image="deleted.gif"
184            onclick="deleteItemPermanently()"
185            tooltip="This item has been flagged for deletion. Click to delete it now."
186            enabled="<%=deletePermanentlyPermission %>"
187            visible="<%=isRemoved%>" 
188          />
189          <base:icon image="used.gif" 
190            onclick="showUsingItems()"
191            tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one"
192            visible="<%=isRemoved && isUsed%>" />
193        </th>
194        <td style="padding: 0px;">
195          <tbl:toolbar subclass="bottomborder">
196            <tbl:button 
197              disabled="<%=!writePermission%>" 
198              image="edit.gif" 
199              onclick="editItem()" 
200              title="Edit&hellip;" 
201              tooltip="<%=writePermission ? "Edit this array slide" : "You do not have permission to edit this array slide"%>" 
202            />
203            <tbl:button 
204              disabled="<%=!deletePermission%>" 
205              image="delete.gif" 
206              onclick="deleteItem()" 
207              title="Delete"
208              visible="<%=!slide.isRemoved()%>"
209              tooltip="<%=deletePermission ? "Delete this array slide" : "You do not have permission to delete this array slide"%>" 
210            />
211            <tbl:button 
212              disabled="<%=!writePermission%>" 
213              image="restore.gif" 
214              onclick="restoreItem()" 
215              title="Restore"
216              visible="<%=slide.isRemoved()%>"
217              tooltip="<%=writePermission ? "Restore this array slide" : "You do not have permission to restore this array slide"%>" 
218            />
219            <tbl:button 
220              disabled="<%=!sharePermission%>"
221              image="share.gif"
222              onclick="shareItem()" 
223              title="Share&hellip;" 
224              tooltip="<%=sharePermission ? "Share this array slide to other user, groups and projects" : "You do not have permission to share this array slide"%>"
225            />
226            <tbl:button 
227              disabled="<%=!setOwnerPermission%>"
228              image="take_ownership.png"
229              onclick="setOwner()" 
230              title="Set owner&hellip;"
231              tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
232            />
233            <tbl:button 
234              image="import.gif" 
235              onclick="runPlugin('ImportItem')" 
236              title="Import&hellip;" 
237              tooltip="Import data" 
238              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
239            />
240            <tbl:button 
241              image="export.gif" 
242              onclick="runPlugin('ExportItem')" 
243              title="Export&hellip;" 
244              tooltip="Export data" 
245              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
246            />
247            <tbl:button 
248              image="runplugin.gif" 
249              onclick="runPlugin('RunPlugin')" 
250              title="Run plugin&hellip;" 
251              tooltip="Run a plugin" 
252              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
253            />
254            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
255              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
256            <tbl:button
257              image="help.png"
258              onclick="<%="Main.openHelp('" + ID +"', 'arrayslide.view.properties')"%>"
259              title="Help&hellip;"
260              tooltip="Get help about this page"
261            />
262          </tbl:toolbar>
263        </td>
264      </tr>
265      <tr>
266        <th>Name</th>
267        <td><%=HTML.encodeTags(slide.getName())%></td>
268      </tr>
269      <tr>
270        <th>Registered</th>
271        <td><%=dateFormatter.format(slide.getEntryDate())%></td>
272      </tr>
273      <tr>
274        <th>Barcode</th>
275        <td><%=HTML.encodeTags(slide.getBarcode())%></td>
276      </tr>
277      <tr>
278        <th>Destroyed</th>
279        <td><%=slide.isDestroyed() ? "yes" : "no"%></td>
280      </tr>
281      <tr>
282        <th>Physical bioassay</th>
283        <td><base:propertyvalue item="<%=slide%>" property="physicalBioAssay" /></td>
284      </tr>
285      <tr>
286        <th>Array batch</th>
287        <td><base:propertyvalue item="<%=slide%>" property="arrayBatch" /></td>
288      </tr>
289      <tr>
290        <th class="subprompt">- index</th>
291        <td><%=slide.getBatchIndex()%></td>
292      </tr>
293      <tr>
294        <th>Array design</th>
295        <td><base:propertyvalue item="<%=slide%>" property="arrayBatch.arrayDesign" /></td>
296      </tr>
297      <tr>
298        <th>Owner</th>
299        <td><base:propertyvalue item="<%=slide%>" property="owner" /></td>
300      </tr>
301      <tr>
302        <th>Permissions</th>
303        <td><%=PermissionUtil.getFullPermissionNames(slide)%></td>
304      </tr>
305      <tr>
306        <th>Description</th>
307        <td><%=HTML.niceFormat(slide.getDescription())%></td>
308      </tr>
309      </table>
310      </div>
311     
312      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
313        <jsp:param name="ID" value="<%=ID%>" />
314        <jsp:param name="item_type" value="<%=itemType.name()%>" />
315        <jsp:param name="item_id" value="<%=itemId%>" />
316        <jsp:param name="title" value="Other items related to this slide" />
317      </jsp:include>
318      <jsp:include page="../../common/share/list_share.jsp">
319        <jsp:param name="ID" value="<%=ID%>" />
320        <jsp:param name="item_type" value="<%=itemType.name()%>" />
321        <jsp:param name="item_id" value="<%=itemId%>" />
322        <jsp:param name="title" value="Shared to" />
323      </jsp:include>
324      </t:tab>
325     
326      <t:tab id="annotations" title="Annotations &amp; parameters" 
327        tooltip="View annotation values and protocol parameters" clazz="white">
328        <jsp:include page="../../common/annotations/list_annotations.jsp">
329          <jsp:param name="item_type" value="<%=itemType.name()%>" />
330          <jsp:param name="item_id" value="<%=itemId%>" />
331          <jsp:param name="ID" value="<%=ID%>" />
332        </jsp:include>
333      </t:tab>
334
335      <t:tab id="overview" title="Overview" 
336        tooltip="Display a tree overview of related items">
337        <%
338        if ("overview".equals(tab))
339        {
340          %>
341          <jsp:include page="../../common/overview/overview.jsp">
342            <jsp:param name="item_type" value="<%=itemType.name()%>" />
343            <jsp:param name="item_id" value="<%=itemId%>" />
344            <jsp:param name="ID" value="<%=ID%>" />
345          </jsp:include>
346          <%
347        }
348        %>
349      </t:tab>
350      <t:tab id="history" title="Change history" 
351        tooltip="Displays a log of all modifications made to this item"
352        visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>">
353        <%
354        if ("history".equals(tab))
355        {
356          %>
357          <jsp:include page="../../common/history/frameset.jsp">
358            <jsp:param name="source_type" value="<%=itemType.name()%>" />
359            <jsp:param name="source_id" value="<%=itemId%>" />
360            <jsp:param name="ID" value="<%=ID%>" />
361          </jsp:include>
362          <%
363        }
364        %>
365      </t:tab>
366    </t:tabcontrol>
367
368  </base:body>
369  </base:page>
370  <%
371}
372finally
373{
374  if (dc != null) dc.close();
375}
376
377%>
Note: See TracBrowser for help on using the repository browser.