1 | <%-- $Id: view_eventtype.jsp 5943 2012-02-01 14:49:04Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
---|
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.PlateType" |
---|
33 | import="net.sf.basedb.core.PlateEventType" |
---|
34 | import="net.sf.basedb.core.PermissionDeniedException" |
---|
35 | import="net.sf.basedb.core.PluginDefinition" |
---|
36 | import="net.sf.basedb.core.data.RawData" |
---|
37 | import="net.sf.basedb.core.plugin.GuiContext" |
---|
38 | import="net.sf.basedb.core.plugin.Plugin" |
---|
39 | import="net.sf.basedb.clients.web.Base" |
---|
40 | import="net.sf.basedb.clients.web.PermissionUtil" |
---|
41 | import="net.sf.basedb.clients.web.util.HTML" |
---|
42 | import="net.sf.basedb.util.Values" |
---|
43 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
44 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
45 | import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
---|
46 | import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
---|
47 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
48 | import="java.util.Date" |
---|
49 | import="java.util.Map" |
---|
50 | import="java.util.Set" |
---|
51 | %> |
---|
52 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
53 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
54 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
55 | <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
---|
56 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
57 | <%! |
---|
58 | private static final Item itemType = Item.PLATEEVENTTYPE; |
---|
59 | private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
---|
60 | %> |
---|
61 | <% |
---|
62 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
63 | final String ID = sc.getId(); |
---|
64 | final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
---|
65 | final int itemId = cc.getId(); |
---|
66 | final float scale = Base.getScale(sc); |
---|
67 | final DbControl dc = sc.newDbControl(); |
---|
68 | try |
---|
69 | { |
---|
70 | Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
---|
71 | |
---|
72 | String title = null; |
---|
73 | final PlateEventType eventType = PlateEventType.getById(dc, itemId); |
---|
74 | final PlateType plateType = eventType.getPlateType(); |
---|
75 | final int plateTypeId = plateType.getId(); |
---|
76 | |
---|
77 | final boolean writePermission = eventType.hasPermission(Permission.WRITE); |
---|
78 | final boolean deletePermission = eventType.hasPermission(Permission.DELETE); |
---|
79 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, eventType); |
---|
80 | ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext); |
---|
81 | %> |
---|
82 | <base:page title="<%=title%>"> |
---|
83 | <base:head scripts="table.js,tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> |
---|
84 | <ext:scripts context="<%=jspContext%>" /> |
---|
85 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
86 | <script language="JavaScript"> |
---|
87 | function editItem() |
---|
88 | { |
---|
89 | Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true); |
---|
90 | } |
---|
91 | function deleteItem() |
---|
92 | { |
---|
93 | if (confirm('This can\'t be undone. Continue?')) |
---|
94 | { |
---|
95 | location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&platetype_id=<%=plateTypeId%>&item_id=<%=itemId%>'); |
---|
96 | } |
---|
97 | } |
---|
98 | function runPlugin(cmd) |
---|
99 | { |
---|
100 | Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&platetype_id=<%=plateTypeId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500); |
---|
101 | } |
---|
102 | </script> |
---|
103 | </base:head> |
---|
104 | <base:body> |
---|
105 | <p:path><p:pathelement |
---|
106 | title="Plate types" href="<%="../index.jsp?ID="+ID%>" |
---|
107 | /><p:pathelement |
---|
108 | title="<%=HTML.encodeTags(plateType.getName())%>" |
---|
109 | href="<%="index.jsp?ID="+ID+"&platetype_id="+plateTypeId%>" |
---|
110 | /><p:pathelement title="<%=HTML.encodeTags(eventType.getName())%>" |
---|
111 | /></p:path> |
---|
112 | |
---|
113 | <t:tabcontrol |
---|
114 | id="main" |
---|
115 | subclass="content mastertabcontrol" |
---|
116 | active="properties"> |
---|
117 | <t:tab id="properties" title="Properties"> |
---|
118 | <div> |
---|
119 | <table class="fullform bottomborder"> |
---|
120 | <tr> |
---|
121 | <th class="itemstatus"></th> |
---|
122 | <td style="padding: 0px;"> |
---|
123 | <tbl:toolbar subclass="bottomborder"> |
---|
124 | <tbl:button |
---|
125 | disabled="<%=!writePermission%>" |
---|
126 | image="edit.gif" |
---|
127 | onclick="editItem()" |
---|
128 | title="Edit…" |
---|
129 | tooltip="<%=writePermission ? "Edit this event type" : "You do not have permission to edit this event type"%>" |
---|
130 | /> |
---|
131 | <tbl:button |
---|
132 | disabled="<%=!deletePermission%>" |
---|
133 | image="delete.gif" |
---|
134 | onclick="deleteItem()" |
---|
135 | title="Delete" |
---|
136 | tooltip="<%=deletePermission ? "Delete this event type" : "You do not have permission to event this plate type"%>" |
---|
137 | /> |
---|
138 | <tbl:button |
---|
139 | image="import.gif" |
---|
140 | onclick="runPlugin('ImportItem')" |
---|
141 | title="Import…" |
---|
142 | tooltip="Import data" |
---|
143 | visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
---|
144 | /> |
---|
145 | <tbl:button |
---|
146 | image="export.gif" |
---|
147 | onclick="runPlugin('ExportItem')" |
---|
148 | title="Export…" |
---|
149 | tooltip="Export data" |
---|
150 | visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
---|
151 | /> |
---|
152 | <tbl:button |
---|
153 | image="runplugin.gif" |
---|
154 | onclick="runPlugin('RunPlugin')" |
---|
155 | title="Run plugin…" |
---|
156 | tooltip="Run a plugin" |
---|
157 | visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
---|
158 | /> |
---|
159 | <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
---|
160 | wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/> |
---|
161 | <tbl:button |
---|
162 | image="help.png" |
---|
163 | onclick="<%="Main.openHelp('" + ID +"', 'plateeventtype.view.properties')"%>" |
---|
164 | title="Help…" |
---|
165 | tooltip="Get help about this page" |
---|
166 | /> |
---|
167 | </tbl:toolbar> |
---|
168 | </td> |
---|
169 | </tr> |
---|
170 | <tr> |
---|
171 | <th>Name</th> |
---|
172 | <td><%=HTML.encodeTags(eventType.getName())%></td> |
---|
173 | </tr> |
---|
174 | <tr> |
---|
175 | <th>Ordinal</th> |
---|
176 | <td><%=eventType.getOrdinal()%></td> |
---|
177 | </tr> |
---|
178 | <tr> |
---|
179 | <th>Protocol type</th> |
---|
180 | <td><base:propertyvalue item="<%=eventType%>" property="protocolType" /></td> |
---|
181 | </tr> |
---|
182 | <tr> |
---|
183 | <th>Permissions</th> |
---|
184 | <td><%=PermissionUtil.getFullPermissionNames(eventType)%></td> |
---|
185 | </tr> |
---|
186 | <tr> |
---|
187 | <th>Description</th> |
---|
188 | <td><%=HTML.niceFormat(eventType.getDescription())%></td> |
---|
189 | </tr> |
---|
190 | </table> |
---|
191 | </div> |
---|
192 | <jsp:include page="../../../common/anytoany/list_anytoany.jsp"> |
---|
193 | <jsp:param name="ID" value="<%=ID%>" /> |
---|
194 | <jsp:param name="item_type" value="<%=itemType.name()%>" /> |
---|
195 | <jsp:param name="item_id" value="<%=itemId%>" /> |
---|
196 | <jsp:param name="title" value="Other items related to this event type" /> |
---|
197 | </jsp:include> |
---|
198 | </t:tab> |
---|
199 | </t:tabcontrol> |
---|
200 | </base:body> |
---|
201 | </base:page> |
---|
202 | <% |
---|
203 | } |
---|
204 | finally |
---|
205 | { |
---|
206 | if (dc != null) dc.close(); |
---|
207 | } |
---|
208 | |
---|
209 | %> |
---|