source: trunk/www/lims/platetypes/eventtypes/view_eventtype.jsp @ 5942

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

References #1655: GUI improvements

Modify lots of boolean taglib parameters.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.1 KB
Line 
1<%-- $Id: view_eventtype.jsp 5942 2012-02-01 14:12:59Z 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<%
62final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
63final String ID = sc.getId();
64final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
65final int itemId = cc.getId();
66final float scale = Base.getScale(sc);
67final DbControl dc = sc.newDbControl();
68try
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>
106    <p:path>
107      <p:pathelement title="Plate types" href="<%="../index.jsp?ID="+ID%>" />
108      <p:pathelement 
109        title="<%=HTML.encodeTags(plateType.getName())%>" 
110        href="<%="index.jsp?ID="+ID+"&platetype_id="+plateTypeId%>" />
111      <p:pathelement title="<%=HTML.encodeTags(eventType.getName())%>" />
112    </p:path>
113   
114    <t:tabcontrol id="main" active="properties">
115    <t:tab id="properties" title="Properties">
116
117    <tbl:toolbar
118      >
119      <tbl:button 
120        disabled="<%=!writePermission%>" 
121        image="edit.gif" 
122        onclick="editItem()" 
123        title="Edit&hellip;" 
124        tooltip="<%=writePermission ? "Edit this event type" : "You do not have permission to edit this event type"%>" 
125      />
126      <tbl:button 
127        disabled="<%=!deletePermission%>" 
128        image="delete.gif" 
129        onclick="deleteItem()" 
130        title="Delete"
131        tooltip="<%=deletePermission ? "Delete this event type" : "You do not have permission to event this plate type"%>" 
132      />
133      <tbl:button 
134        image="import.gif" 
135        onclick="runPlugin('ImportItem')" 
136        title="Import&hellip;" 
137        tooltip="Import data" 
138        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
139      />
140      <tbl:button 
141        image="export.gif" 
142        onclick="runPlugin('ExportItem')" 
143        title="Export&hellip;" 
144        tooltip="Export data" 
145        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
146      />
147      <tbl:button 
148        image="runplugin.gif" 
149        onclick="runPlugin('RunPlugin')" 
150        title="Run plugin&hellip;" 
151        tooltip="Run a plugin" 
152        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
153      />
154      <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
155        wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
156        <tbl:button
157          image="help.png"
158          onclick="<%="Main.openHelp('" + ID +"', 'plateeventtype.view.properties')"%>"
159          title="Help&hellip;"
160          tooltip="Get help about this page"
161        />
162      </tbl:toolbar>
163     
164    <div class="boxedbottom">
165      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(eventType)%></i></div>
166      <table class="form" cellspacing=0>
167      <tr>
168        <td class="prompt">Name</td>
169        <td><%=HTML.encodeTags(eventType.getName())%></td>
170      </tr>
171      <tr>
172        <td class="prompt">Ordinal</td>
173        <td><%=eventType.getOrdinal()%></td>
174      </tr>
175      <tr>
176        <td class="prompt">Protocol type</td>
177        <td><base:propertyvalue item="<%=eventType%>" property="protocolType" /></td>
178      </tr>
179      <tr>
180        <td class="prompt">Description</td>
181        <td><%=HTML.niceFormat(eventType.getDescription())%></td>
182      </tr>
183      </table>
184      <jsp:include page="../../../common/anytoany/list_anytoany.jsp">
185        <jsp:param name="ID" value="<%=ID%>" />
186        <jsp:param name="item_type" value="<%=itemType.name()%>" />
187        <jsp:param name="item_id" value="<%=itemId%>" />
188        <jsp:param name="title" value="Other items related to this event type" />
189      </jsp:include>
190    </div>
191      </t:tab>
192      </t:tabcontrol>
193
194  </base:body>
195  </base:page>
196  <%
197}
198finally
199{
200  if (dc != null) dc.close();
201}
202
203%>
Note: See TracBrowser for help on using the repository browser.