source: trunk/www/biomaterials/bioplateeventtypes/view_eventtype.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: 8.7 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 float scale = Base.getScale(sc);
72final DbControl dc = sc.newDbControl();
73try
74{
75  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
76
77  String title = null;
78  BioPlateEventType eventType = BioPlateEventType.getById(dc, itemId);
79 
80  final boolean usePermission = eventType.hasPermission(Permission.USE);
81  final boolean writePermission = eventType.hasPermission(Permission.WRITE);
82  final boolean deletePermission = eventType.hasPermission(Permission.DELETE);
83  final boolean sharePermission = eventType.hasPermission(Permission.SET_PERMISSION);
84  final boolean isRemoved = eventType.isRemoved();
85  final boolean isUsed = isRemoved && eventType.isUsed();
86  final boolean deletePermanentlyPermission = deletePermission && !isUsed;
87  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, eventType);
88  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
89  %>
90  <base:page title="<%=title%>">
91  <base:head scripts="table.js,tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
92    <ext:scripts context="<%=jspContext%>" />
93    <ext:stylesheets context="<%=jspContext%>" />
94    <script>
95    function editItem()
96    {
97      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
98    }
99    function deleteItem()
100    {
101      location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');
102    }
103    function restoreItem()
104    {
105      location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');
106    }
107    function deleteItemPermanently()
108    {
109      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');
110    }
111    function itemDeleted()
112    {
113      Main.listItems('<%=ID%>', '<%=itemType.name()%>');
114    }
115    function showUsingItems()
116    {
117      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
118    }
119    function runPlugin(cmd)
120    {
121      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);
122    }
123    </script>
124  </base:head>
125  <base:body>
126    <p:path><p:pathelement 
127      title="Bioplate event types" href="<%="index.jsp?ID="+ID%>" 
128      /><p:pathelement title="<%=HTML.encodeTags(eventType.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
155            <tbl:button 
156              disabled="<%=!writePermission%>" 
157              image="edit.png" 
158              onclick="editItem()" 
159              title="Edit&hellip;" 
160              tooltip="<%=writePermission ? "Edit this bioplate event type" : "You do not have permission to edit this bioplate event type"%>" 
161            />
162            <tbl:button 
163              disabled="<%=!deletePermission%>" 
164              image="delete.png" 
165              onclick="deleteItem()" 
166              title="Delete"
167              visible="<%=!eventType.isRemoved()%>"
168              tooltip="<%=deletePermission ? "Delete this bioplate event type" : "You do not have permission to delete this bioplate event type"%>" 
169            />
170            <tbl:button 
171              disabled="<%=!writePermission%>" 
172              image="restore.png" 
173              onclick="restoreItem()" 
174              title="Restore"
175              visible="<%=eventType.isRemoved()%>"
176              tooltip="<%=writePermission ? "Restore this bioplate event type" : "You do not have permission to restore this bioplate event type"%>" 
177            />
178            <tbl:button 
179              image="import.png" 
180              onclick="runPlugin('ImportItem')" 
181              title="Import&hellip;" 
182              tooltip="Import data" 
183              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
184            />
185            <tbl:button 
186              image="export.png" 
187              onclick="runPlugin('ExportItem')" 
188              title="Export&hellip;" 
189              tooltip="Export data" 
190              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
191            />
192            <tbl:button 
193              image="runplugin.png" 
194              onclick="runPlugin('RunPlugin')" 
195              title="Run plugin&hellip;" 
196              tooltip="Run a plugin" 
197              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
198            />
199            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
200              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
201            <tbl:button
202              image="help.png"
203              onclick="<%="Main.openHelp('" + ID +"', 'bioplateeventtype.view.properties')"%>"
204              title="Help&hellip;"
205              tooltip="Get help about this page"
206            />
207          </tbl:toolbar>
208        </td>
209      </tr>
210      <tr>
211        <th>Name</th>
212        <td><%=HTML.encodeTags(eventType.getName())%></td>
213      </tr>
214      <tr>
215        <th>System ID</th>
216        <td><%=HTML.encodeTags(eventType.getSystemId())%></td>
217      </tr>
218      <tr>
219        <th>Permissions</th>
220        <td><%=PermissionUtil.getFullPermissionNames(eventType)%></td>
221      </tr>
222      <tr>
223        <th>Description</th>
224        <td><%=HTML.niceFormat(eventType.getDescription())%></td>
225      </tr>
226      </table>
227      </div>
228
229      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
230        <jsp:param name="ID" value="<%=ID%>" />
231        <jsp:param name="item_type" value="<%=itemType.name()%>" />
232        <jsp:param name="item_id" value="<%=itemId%>" />
233        <jsp:param name="title" value="Other items related to this event type" />
234      </jsp:include>
235
236      </t:tab>
237      </t:tabcontrol>
238  </base:body>
239  </base:page>
240  <%
241}
242finally
243{
244  if (dc != null) dc.close();
245}
246
247%>
Note: See TracBrowser for help on using the repository browser.