source: trunk/www/biomaterials/bioplateeventtypes/view_eventtype.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.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--%>
24<%@ page pageEncoding="UTF-8" session="false"
25  import="net.sf.basedb.core.SessionControl"
26  import="net.sf.basedb.core.DbControl"
27  import="net.sf.basedb.core.SystemItems"
28  import="net.sf.basedb.core.Item"
29  import="net.sf.basedb.core.ItemContext"
30  import="net.sf.basedb.core.Permission"
31  import="net.sf.basedb.core.BioPlateEventType"
32  import="net.sf.basedb.core.ItemQuery"
33  import="net.sf.basedb.core.Include"
34  import="net.sf.basedb.core.ItemResultList"
35  import="net.sf.basedb.core.PermissionDeniedException"
36  import="net.sf.basedb.core.PluginDefinition"
37  import="net.sf.basedb.core.plugin.GuiContext"
38  import="net.sf.basedb.core.plugin.Plugin"
39  import="net.sf.basedb.core.query.Orders"
40  import="net.sf.basedb.core.query.Hql"
41  import="net.sf.basedb.clients.web.Base"
42  import="net.sf.basedb.clients.web.PermissionUtil"
43  import="net.sf.basedb.clients.web.util.HTML"
44  import="net.sf.basedb.util.Values"
45  import="net.sf.basedb.util.formatter.Formatter"
46  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
47  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
48  import="net.sf.basedb.clients.web.extensions.JspContext"
49  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
50  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
51  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
52  import="java.util.Date"
53  import="java.util.Map"
54  import="java.util.Set"
55  import="java.util.List"
56%>
57<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
58<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
59<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
60<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
61<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
62<%!
63  private static final Item itemType = Item.BIOPLATEEVENTTYPE;
64  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
65%>
66<%
67final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
68final String ID = sc.getId();
69final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
70final int itemId = cc.getId();
71final String tab = Values.getStringOrNull(request.getParameter("tab"));
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  BioPlateEventType eventType = BioPlateEventType.getById(dc, itemId);
80 
81  final boolean usePermission = eventType.hasPermission(Permission.USE);
82  final boolean writePermission = eventType.hasPermission(Permission.WRITE);
83  final boolean deletePermission = eventType.hasPermission(Permission.DELETE);
84  final boolean sharePermission = eventType.hasPermission(Permission.SET_PERMISSION);
85  final boolean isRemoved = eventType.isRemoved();
86  final boolean isUsed = isRemoved && eventType.isUsed();
87  final boolean deletePermanentlyPermission = deletePermission && !isUsed;
88  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, eventType);
89  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
90  %>
91  <base:page title="<%=title%>" id="view-page">
92  <base:head scripts="table.js,tabcontrol-2.js,~bioplateeventtypes.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
93    <ext:scripts context="<%=jspContext%>" />
94    <ext:stylesheets context="<%=jspContext%>" />
95  </base:head>
96  <base:body>
97    <p:path><p:pathelement 
98      title="Bioplate event types" href="<%="index.jsp?ID="+ID%>" 
99      /><p:pathelement title="<%=HTML.encodeTags(eventType.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
128            <tbl:button 
129              id="btnEdit"
130              disabled="<%=!writePermission%>" 
131              image="edit.png" 
132              title="Edit&hellip;" 
133              tooltip="<%=writePermission ? "Edit this bioplate event type" : "You do not have permission to edit this bioplate event type"%>" 
134            />
135            <tbl:button 
136              id="btnDelete"
137              disabled="<%=!deletePermission%>" 
138              image="delete.png" 
139              title="Delete"
140              visible="<%=!eventType.isRemoved()%>"
141              tooltip="<%=deletePermission ? "Delete this bioplate event type" : "You do not have permission to delete this bioplate event type"%>" 
142            />
143            <tbl:button 
144              id="btnRestore"
145              disabled="<%=!writePermission%>" 
146              image="restore.png" 
147              title="Restore"
148              visible="<%=eventType.isRemoved()%>"
149              tooltip="<%=writePermission ? "Restore this bioplate event type" : "You do not have permission to restore this bioplate event type"%>" 
150            />
151            <tbl:button 
152              id="btnImport"
153              image="import.png" 
154              data-plugin-type="IMPORT" 
155              title="Import&hellip;" 
156              tooltip="Import data" 
157              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
158            />
159            <tbl:button 
160              id="btnExport"
161              image="export.png"
162              data-plugin-type="EXPORT" 
163              title="Export&hellip;" 
164              tooltip="Export data" 
165              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
166            />
167            <tbl:button 
168              id="btnRunPlugin"
169              image="runplugin.png" 
170              data-plugin-type="OTHER" 
171              title="Run plugin&hellip;" 
172              tooltip="Run a plugin" 
173              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
174            />
175            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
176              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
177            <tbl:button
178              image="help.png"
179              subclass="auto-init"
180              data-auto-init="help"
181              data-help-id="bioplateeventtype.view.properties"
182              title="Help&hellip;"
183              tooltip="Get help about this page"
184            />
185          </tbl:toolbar>
186        </td>
187      </tr>
188      <tr>
189        <th>Name</th>
190        <td><%=HTML.encodeTags(eventType.getName())%></td>
191      </tr>
192      <tr>
193        <th>System ID</th>
194        <td><%=HTML.encodeTags(eventType.getSystemId())%></td>
195      </tr>
196      <tr>
197        <th>Permissions</th>
198        <td><%=PermissionUtil.getFullPermissionNames(eventType)%></td>
199      </tr>
200      <tr>
201        <th>Description</th>
202        <td><%=HTML.niceFormat(eventType.getDescription())%></td>
203      </tr>
204      </table>
205      </div>
206
207      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
208        <jsp:param name="ID" value="<%=ID%>" />
209        <jsp:param name="item_type" value="<%=itemType.name()%>" />
210        <jsp:param name="item_id" value="<%=itemId%>" />
211        <jsp:param name="title" value="Other items related to this event type" />
212      </jsp:include>
213
214      </t:tab>
215      </t:tabcontrol>
216  </base:body>
217  </base:page>
218  <%
219}
220finally
221{
222  if (dc != null) dc.close();
223}
224
225%>
Note: See TracBrowser for help on using the repository browser.