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

Last change on this file since 6136 was 6136, checked in by Nicklas Nordborg, 11 years ago

References #1727: Move to HTML5

  • Remove language="javascript" from <script> tags in all JSP files.
  • 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>
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, 750, 500);
123    }
124    </script>
125  </base:head>
126  <base:body>
127    <p:path><p:pathelement title="Bioplate types" href="<%="index.jsp?ID="+ID%>" 
128      /><p:pathelement title="<%=HTML.encodeTags(plateType.getName())%>" 
129      /></p:path>
130   
131    <t:tabcontrol 
132      id="main" 
133      subclass="content mastertabcontrol"
134      active="properties">
135    <t:tab id="properties" title="Properties">
136      <div>
137      <table class="fullform bottomborder">
138      <tr>
139        <th class="itemstatus">
140          <base:icon 
141            image="deleted.png"
142            onclick="deleteItemPermanently()"
143            tooltip="This item has been flagged for deletion. Click to delete it now."
144            enabled="<%=deletePermanentlyPermission %>"
145            visible="<%=isRemoved%>" 
146          />
147          <base:icon image="used.png" 
148            onclick="showUsingItems()"
149            tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one"
150            visible="<%=isRemoved && isUsed%>" />
151        </th>
152        <td style="padding: 0px;">
153          <tbl:toolbar subclass="bottomborder">
154            <tbl:button 
155              disabled="<%=!writePermission%>" 
156              image="edit.png" 
157              onclick="editItem()" 
158              title="Edit&hellip;" 
159              tooltip="<%=writePermission ? "Edit this bioplate type" : "You do not have permission to edit this bioplate type"%>" 
160            />
161            <tbl:button 
162              disabled="<%=!deletePermission%>" 
163              image="delete.png" 
164              onclick="deleteItem()" 
165              title="Delete"
166              visible="<%=!plateType.isRemoved()%>"
167              tooltip="<%=deletePermission ? "Delete this bioplate type" : "You do not have permission to delete this bioplate type"%>" 
168            />
169            <tbl:button 
170              disabled="<%=!writePermission%>" 
171              image="restore.png" 
172              onclick="restoreItem()" 
173              title="Restore"
174              visible="<%=plateType.isRemoved()%>"
175              tooltip="<%=writePermission ? "Restore this bioplate type" : "You do not have permission to restore this bioplate type"%>" 
176            />
177            <tbl:button 
178              image="import.png" 
179              onclick="runPlugin('ImportItem')" 
180              title="Import&hellip;" 
181              tooltip="Import data" 
182              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
183            />
184            <tbl:button 
185              image="export.png" 
186              onclick="runPlugin('ExportItem')" 
187              title="Export&hellip;" 
188              tooltip="Export data" 
189              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
190            />
191            <tbl:button 
192              image="runplugin.png" 
193              onclick="runPlugin('RunPlugin')" 
194              title="Run plugin&hellip;" 
195              tooltip="Run a plugin" 
196              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
197            />
198            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
199              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
200            <tbl:button
201              image="help.png"
202              onclick="<%="Main.openHelp('" + ID +"', 'bioplatetype.view.properties')"%>"
203              title="Help&hellip;"
204              tooltip="Get help about this page"
205            />
206          </tbl:toolbar>
207        </td>
208      </tr>
209      <tr>
210        <th>Name</th>
211        <td><%=HTML.encodeTags(plateType.getName())%></td>
212      </tr>
213      <tr>
214        <th>Biomaterial type</th>
215        <td><%=plateType.getBioMaterialType() == null ? "<i>- any -</i>" : plateType.getBioMaterialType()%></td>
216      </tr>
217      <tr>
218        <th>Biomaterial subtype</th>
219        <td><base:propertyvalue item="<%=plateType%>" property="itemSubtype" nulltext="<i>- any -</i>"/></td>
220      </tr>
221      <tr>
222        <th>Storage type</th>
223        <td><base:propertyvalue item="<%=plateType%>" property="storageType" /></td>
224      </tr>
225      <tr>
226        <th>Well lock mode</th>
227        <td><%=plateType.getLockMode()%></td>
228      </tr>
229        <tr>
230          <th>Permissions</th>
231          <td><%=PermissionUtil.getFullPermissionNames(plateType)%></td>
232        </tr>
233      <tr>
234        <th>Description</th>
235        <td><%=HTML.niceFormat(plateType.getDescription())%></td>
236      </tr>
237      </table>
238      </div>
239
240      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
241        <jsp:param name="ID" value="<%=ID%>" />
242        <jsp:param name="item_type" value="<%=itemType.name()%>" />
243        <jsp:param name="item_id" value="<%=itemId%>" />
244        <jsp:param name="title" value="Other items related to this plate type" />
245      </jsp:include>
246      </t:tab>
247      </t:tabcontrol>
248  </base:body>
249  </base:page>
250  <%
251}
252finally
253{
254  if (dc != null) dc.close();
255}
256
257%>
Note: See TracBrowser for help on using the repository browser.