source: trunk/www/biomaterials/bioplatetypes/view_platetype.jsp @ 5709

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

References #1597: Subtypes of items

Added link to item subtype from bioplate type which makes it possible to restrict/filter on the biomaterial subtype when selecting biomaterial for a plate. The "restriction" is in the gui only and is not checked by the core since it is possible to change the subtype of a biomaterial after it has been placed on a plate.

As a result of this the "Labeled extract reaction plate" is brought back to life again.

Also discovered that the bioplate event wizards should probably be able to utilize subtype information for some improvements. So there are still some things to fix before this ticket can be closed.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 9.1 KB
Line 
1<%-- $Id $
2  ------------------------------------------------------------------
3  Copyright (C) 2010 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  @author Nicklas
23  @version 2.0
24--%>
25<%@ page pageEncoding="UTF-8" session="false"
26  import="net.sf.basedb.core.SessionControl"
27  import="net.sf.basedb.core.DbControl"
28  import="net.sf.basedb.core.SystemItems"
29  import="net.sf.basedb.core.Item"
30  import="net.sf.basedb.core.ItemContext"
31  import="net.sf.basedb.core.Permission"
32  import="net.sf.basedb.core.BioPlateType"
33  import="net.sf.basedb.core.ItemQuery"
34  import="net.sf.basedb.core.Include"
35  import="net.sf.basedb.core.ItemResultList"
36  import="net.sf.basedb.core.PermissionDeniedException"
37  import="net.sf.basedb.core.PluginDefinition"
38  import="net.sf.basedb.core.plugin.GuiContext"
39  import="net.sf.basedb.core.plugin.Plugin"
40  import="net.sf.basedb.core.query.Orders"
41  import="net.sf.basedb.core.query.Hql"
42  import="net.sf.basedb.clients.web.Base"
43  import="net.sf.basedb.clients.web.PermissionUtil"
44  import="net.sf.basedb.clients.web.util.HTML"
45  import="net.sf.basedb.util.Values"
46  import="net.sf.basedb.util.formatter.Formatter"
47  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
48  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
49  import="net.sf.basedb.clients.web.extensions.JspContext"
50  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
51  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
52  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
53  import="java.util.Date"
54  import="java.util.Map"
55  import="java.util.Set"
56  import="java.util.List"
57%>
58<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
59<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
60<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
61<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
62<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
63<%!
64  private static final Item itemType = Item.BIOPLATETYPE;
65  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
66%>
67<%
68final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
69final String ID = sc.getId();
70final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
71final int itemId = cc.getId();
72final float scale = Base.getScale(sc);
73final DbControl dc = sc.newDbControl();
74try
75{
76  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
77
78  String title = null;
79  BioPlateType plateType = BioPlateType.getById(dc, itemId);
80 
81  final boolean usePermission = plateType.hasPermission(Permission.USE);
82  final boolean writePermission = plateType.hasPermission(Permission.WRITE);
83  final boolean deletePermission = plateType.hasPermission(Permission.DELETE);
84  final boolean sharePermission = plateType.hasPermission(Permission.SET_PERMISSION);
85  final boolean isRemoved = plateType.isRemoved();
86  final boolean isUsed = isRemoved && plateType.isUsed();
87  final boolean deletePermanentlyPermission = deletePermission && !isUsed;
88  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, plateType);
89  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
90  %>
91  <base:page title="<%=title%>">
92  <base:head scripts="table.js,tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
93    <ext:scripts context="<%=jspContext%>" />
94    <ext:stylesheets context="<%=jspContext%>" />
95    <script language="JavaScript">
96    function editItem()
97    {
98      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
99    }
100    function deleteItem()
101    {
102      location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');
103    }
104    function restoreItem()
105    {
106      location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');
107    }
108    function deleteItemPermanently()
109    {
110      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');
111    }
112    function itemDeleted()
113    {
114      Main.listItems('<%=ID%>', '<%=itemType.name()%>');
115    }
116    function showUsingItems()
117    {
118      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
119    }
120    function runPlugin(cmd)
121    {
122      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
123    }
124    </script>
125  </base:head>
126  <base:body>
127    <p>
128    <p:path>
129      <p:pathelement title="Bioplate types" href="<%="index.jsp?ID="+ID%>" />
130      <p:pathelement title="<%=HTML.encodeTags(plateType.getName())%>" />
131    </p:path>
132   
133    <t:tabcontrol id="main" active="properties">
134    <t:tab id="properties" title="Properties">
135   
136    <tbl:toolbar
137      >
138      <tbl:button 
139        disabled="<%=writePermission ? false : true%>" 
140        image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" 
141        onclick="editItem()" 
142        title="Edit&hellip;" 
143        tooltip="<%=writePermission ? "Edit this bioplate type" : "You do not have permission to edit this bioplate type"%>" 
144      />
145      <tbl:button 
146        disabled="<%=deletePermission ? false : true%>" 
147        image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" 
148        onclick="deleteItem()" 
149        title="Delete"
150        visible="<%=!plateType.isRemoved()%>"
151        tooltip="<%=deletePermission ? "Delete this bioplate type" : "You do not have permission to delete this bioplate type"%>" 
152      />
153      <tbl:button 
154        disabled="<%=writePermission ? false : true%>" 
155        image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" 
156        onclick="restoreItem()" 
157        title="Restore"
158        visible="<%=plateType.isRemoved()%>"
159        tooltip="<%=writePermission ? "Restore this bioplate type" : "You do not have permission to restore this bioplate type"%>" 
160      />
161      <tbl:button 
162        image="import.gif" 
163        onclick="runPlugin('ImportItem')" 
164        title="Import&hellip;" 
165        tooltip="Import data" 
166        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
167      />
168      <tbl:button 
169        image="export.gif" 
170        onclick="runPlugin('ExportItem')" 
171        title="Export&hellip;" 
172        tooltip="Export data" 
173        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
174      />
175      <tbl:button 
176        image="runplugin.gif" 
177        onclick="runPlugin('RunPlugin')" 
178        title="Run plugin&hellip;" 
179        tooltip="Run a plugin" 
180        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
181      />
182      <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
183        wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
184      <tbl:button
185        image="help.gif"
186        onclick="<%="Main.openHelp('" + ID +"', 'bioplatetype.view.properties')"%>"
187        title="Help&hellip;"
188        tooltip="Get help about this page"
189      />
190      </tbl:toolbar>
191    <div class="boxedbottom">
192      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(plateType)%></i></div>
193      <%
194      if (plateType.isRemoved())
195      {
196        %>
197        <div class="itemstatus">
198          <base:icon 
199            image="<%=deletePermanentlyPermission ? "deleted.gif" : "deleted_disabled.gif"%>"
200            onclick="<%=deletePermanentlyPermission ? "deleteItemPermanently()" : null%>"
201            tooltip="<%=deletePermanentlyPermission ? "Permanently delete this item" : null%>"
202            visible="<%=isRemoved%>"> This item has been flagged for deletion<br></base:icon>
203          <base:icon image="used.gif" 
204            onclick="showUsingItems()"
205            tooltip="Show the items that are using this one"
206            visible="<%=isUsed%>"> This item is used by other items and can't be permanently deleted<br></base:icon>
207        </div>
208        <%
209      }
210      %>
211      <table class="form" cellspacing=0>
212      <tr>
213        <td class="prompt">Name</td>
214        <td><%=HTML.encodeTags(plateType.getName())%></td>
215      </tr>
216      <tr>
217        <td class="prompt">Biomaterial type</td>
218        <td><%=plateType.getBioMaterialType() == null ? "<i>- any -</i>" : plateType.getBioMaterialType()%></td>
219      </tr>
220      <tr>
221        <td class="prompt">Biomaterial subtype</td>
222        <td><base:propertyvalue item="<%=plateType%>" property="itemSubtype" nulltext="<i>- any -</i>"/></td>
223      </tr>
224      <tr>
225        <td class="prompt">Well lock mode</td>
226        <td><%=plateType.getLockMode()%></td>
227      </tr>
228      <tr>
229        <td class="prompt">Description</td>
230        <td><%=HTML.niceFormat(plateType.getDescription())%></td>
231      </tr>
232      </table>
233
234      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
235        <jsp:param name="ID" value="<%=ID%>" />
236        <jsp:param name="item_type" value="<%=itemType.name()%>" />
237        <jsp:param name="item_id" value="<%=itemId%>" />
238        <jsp:param name="title" value="Other items related to this plate type" />
239      </jsp:include>
240    </div>
241      </t:tab>
242      </t:tabcontrol>
243
244
245  </base:body>
246  </base:page>
247  <%
248}
249finally
250{
251  if (dc != null) dc.close();
252}
253
254%>
Note: See TracBrowser for help on using the repository browser.