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

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

References #1729 and #1730. Fixed for all biomaterial view pages.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 8.4 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 String tab = Values.getStringOrNull(request.getParameter("tab"));
73final float scale = Base.getScale(sc);
74final DbControl dc = sc.newDbControl();
75try
76{
77  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
78
79  String title = null;
80  BioPlateType plateType = BioPlateType.getById(dc, itemId);
81 
82  final boolean usePermission = plateType.hasPermission(Permission.USE);
83  final boolean writePermission = plateType.hasPermission(Permission.WRITE);
84  final boolean deletePermission = plateType.hasPermission(Permission.DELETE);
85  final boolean sharePermission = plateType.hasPermission(Permission.SET_PERMISSION);
86  final boolean isRemoved = plateType.isRemoved();
87  final boolean isUsed = isRemoved && plateType.isUsed();
88  final boolean deletePermanentlyPermission = deletePermission && !isUsed;
89  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, plateType);
90  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
91  %>
92  <base:page title="<%=title%>" id="view-page">
93  <base:head scripts="table.js,tabcontrol-2.js,~bioplatetypes.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
94    <ext:scripts context="<%=jspContext%>" />
95    <ext:stylesheets context="<%=jspContext%>" />
96  </base:head>
97  <base:body>
98    <p:path><p:pathelement title="Bioplate types" href="<%="index.jsp?ID="+ID%>" 
99      /><p:pathelement title="<%=HTML.encodeTags(plateType.getName())%>" 
100      /></p:path>
101    <div id="page-data" data-item-id="<%=itemId%>"></div>
102   
103    <t:tabcontrol 
104      id="main" 
105      subclass="content mastertabcontrol"
106      active="<%=tab%>">
107    <t:tab id="properties" title="Properties">
108      <div>
109      <table class="fullform bottomborder">
110      <tr>
111        <th class="itemstatus">
112          <base:icon 
113            id="btnDeletePermanently"
114            image="deleted.png"
115            tooltip="This item has been flagged for deletion. Click to delete it now."
116            enabled="<%=deletePermanentlyPermission %>"
117            visible="<%=isRemoved%>" 
118          />
119          <base:icon
120            id="btnUsingItems"
121            image="used.png" 
122            tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one"
123            visible="<%=isRemoved && isUsed%>" />
124        </th>
125        <td style="padding: 0px;">
126          <tbl:toolbar subclass="bottomborder">
127            <tbl:button 
128              id="btnEdit"
129              disabled="<%=!writePermission%>" 
130              image="edit.png" 
131              title="Edit&hellip;" 
132              tooltip="<%=writePermission ? "Edit this bioplate type" : "You do not have permission to edit this bioplate type"%>" 
133            />
134            <tbl:button 
135              id="btnDelete"
136              disabled="<%=!deletePermission%>" 
137              image="delete.png" 
138              title="Delete"
139              visible="<%=!plateType.isRemoved()%>"
140              tooltip="<%=deletePermission ? "Delete this bioplate type" : "You do not have permission to delete this bioplate type"%>" 
141            />
142            <tbl:button 
143              id="btnRestore"
144              disabled="<%=!writePermission%>" 
145              image="restore.png" 
146              title="Restore"
147              visible="<%=plateType.isRemoved()%>"
148              tooltip="<%=writePermission ? "Restore this bioplate type" : "You do not have permission to restore this bioplate type"%>" 
149            />
150            <tbl:button 
151              id="btnImport"
152              image="import.png" 
153              data-plugin-type="IMPORT" 
154              title="Import&hellip;" 
155              tooltip="Import data" 
156              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
157            />
158            <tbl:button 
159              id="btnExport"
160              image="export.png"
161              data-plugin-type="EXPORT" 
162              title="Export&hellip;" 
163              tooltip="Export data" 
164              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
165            />
166            <tbl:button 
167              id="btnRunPlugin"
168              image="runplugin.png" 
169              data-plugin-type="OTHER" 
170              title="Run plugin&hellip;" 
171              tooltip="Run a plugin" 
172              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
173            />
174            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
175              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
176            <tbl:button
177              image="help.png"
178              subclass="auto-init"
179              data-auto-init="help"
180              data-help-id="bioplatetype.view.properties"
181              title="Help&hellip;"
182              tooltip="Get help about this page"
183            />
184          </tbl:toolbar>
185        </td>
186      </tr>
187      <tr>
188        <th>Name</th>
189        <td><%=HTML.encodeTags(plateType.getName())%></td>
190      </tr>
191      <tr>
192        <th>Biomaterial type</th>
193        <td><%=plateType.getBioMaterialType() == null ? "<i>- any -</i>" : plateType.getBioMaterialType()%></td>
194      </tr>
195      <tr>
196        <th>Biomaterial subtype</th>
197        <td><base:propertyvalue item="<%=plateType%>" property="itemSubtype" nulltext="<i>- any -</i>"/></td>
198      </tr>
199      <tr>
200        <th>Storage type</th>
201        <td><base:propertyvalue item="<%=plateType%>" property="storageType" /></td>
202      </tr>
203      <tr>
204        <th>Well lock mode</th>
205        <td><%=plateType.getLockMode()%></td>
206      </tr>
207        <tr>
208          <th>Permissions</th>
209          <td><%=PermissionUtil.getFullPermissionNames(plateType)%></td>
210        </tr>
211      <tr>
212        <th>Description</th>
213        <td><%=HTML.niceFormat(plateType.getDescription())%></td>
214      </tr>
215      </table>
216      </div>
217
218      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
219        <jsp:param name="ID" value="<%=ID%>" />
220        <jsp:param name="item_type" value="<%=itemType.name()%>" />
221        <jsp:param name="item_id" value="<%=itemId%>" />
222        <jsp:param name="title" value="Other items related to this plate type" />
223      </jsp:include>
224      </t:tab>
225      </t:tabcontrol>
226  </base:body>
227  </base:page>
228  <%
229}
230finally
231{
232  if (dc != null) dc.close();
233}
234
235%>
Note: See TracBrowser for help on using the repository browser.