www/lims/platetypes/eventtypes/view_eventtype.jsp

Code
Comments
Other
Rev Date Author Line
2305 22 May 06 jari 1 <%-- $Id$
2305 22 May 06 jari 2   ------------------------------------------------------------------
5425 23 Sep 10 nicklas 3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
2305 22 May 06 jari 4
2304 22 May 06 jari 5   This file is part of BASE - BioArray Software Environment.
2304 22 May 06 jari 6   Available at http://base.thep.lu.se/
2305 22 May 06 jari 7
2305 22 May 06 jari 8   BASE is free software; you can redistribute it and/or
2305 22 May 06 jari 9   modify it under the terms of the GNU General Public License
4476 05 Sep 08 jari 10   as published by the Free Software Foundation; either version 3
2305 22 May 06 jari 11   of the License, or (at your option) any later version.
2305 22 May 06 jari 12
2305 22 May 06 jari 13   BASE is distributed in the hope that it will be useful,
2305 22 May 06 jari 14   but WITHOUT ANY WARRANTY; without even the implied warranty of
2305 22 May 06 jari 15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2305 22 May 06 jari 16   GNU General Public License for more details.
2305 22 May 06 jari 17
2305 22 May 06 jari 18   You should have received a copy of the GNU General Public License
4511 11 Sep 08 jari 19   along with BASE. If not, see <http://www.gnu.org/licenses/>.
2305 22 May 06 jari 20   ------------------------------------------------------------------
2305 22 May 06 jari 21
2305 22 May 06 jari 22   @author Nicklas
2305 22 May 06 jari 23   @version 2.0
2305 22 May 06 jari 24 --%>
5426 24 Sep 10 nicklas 25 <%@ page pageEncoding="UTF-8" session="false"
2305 22 May 06 jari 26   import="net.sf.basedb.core.SessionControl"
2305 22 May 06 jari 27   import="net.sf.basedb.core.DbControl"
2305 22 May 06 jari 28   import="net.sf.basedb.core.SystemItems"
2305 22 May 06 jari 29   import="net.sf.basedb.core.Item"
2305 22 May 06 jari 30   import="net.sf.basedb.core.ItemContext"
2305 22 May 06 jari 31   import="net.sf.basedb.core.Permission"
2305 22 May 06 jari 32   import="net.sf.basedb.core.PlateType"
2305 22 May 06 jari 33   import="net.sf.basedb.core.PlateEventType"
2305 22 May 06 jari 34   import="net.sf.basedb.core.PermissionDeniedException"
2305 22 May 06 jari 35   import="net.sf.basedb.core.PluginDefinition"
2305 22 May 06 jari 36   import="net.sf.basedb.core.data.RawData"
2305 22 May 06 jari 37   import="net.sf.basedb.core.plugin.GuiContext"
2305 22 May 06 jari 38   import="net.sf.basedb.core.plugin.Plugin"
2305 22 May 06 jari 39   import="net.sf.basedb.clients.web.Base"
2386 15 Jun 06 martin 40   import="net.sf.basedb.clients.web.PermissionUtil"
2305 22 May 06 jari 41   import="net.sf.basedb.clients.web.util.HTML"
2753 20 Oct 06 nicklas 42   import="net.sf.basedb.util.Values"
4884 03 Apr 09 nicklas 43   import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
4884 03 Apr 09 nicklas 44   import="net.sf.basedb.clients.web.extensions.JspContext"
4884 03 Apr 09 nicklas 45   import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
7604 25 Feb 19 nicklas 46   import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" 
4884 03 Apr 09 nicklas 47   import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
4884 03 Apr 09 nicklas 48   import="net.sf.basedb.util.extensions.ExtensionsInvoker"
2305 22 May 06 jari 49   import="java.util.Date"
2305 22 May 06 jari 50   import="java.util.Map"
2305 22 May 06 jari 51   import="java.util.Set"
2305 22 May 06 jari 52 %>
2305 22 May 06 jari 53 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
2305 22 May 06 jari 54 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
2305 22 May 06 jari 55 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
2305 22 May 06 jari 56 <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
4884 03 Apr 09 nicklas 57 <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
2305 22 May 06 jari 58 <%!
2305 22 May 06 jari 59   private static final Item itemType = Item.PLATEEVENTTYPE;
2305 22 May 06 jari 60   private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
2305 22 May 06 jari 61 %>
2305 22 May 06 jari 62 <%
2305 22 May 06 jari 63 final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
2305 22 May 06 jari 64 final String ID = sc.getId();
2305 22 May 06 jari 65 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
2305 22 May 06 jari 66 final int itemId = cc.getId();
2305 22 May 06 jari 67 final float scale = Base.getScale(sc);
7954 12 May 21 nicklas 68 final DbControl dc = sc.newDbControl(":View "+itemType);
2305 22 May 06 jari 69 try
2305 22 May 06 jari 70 {
2305 22 May 06 jari 71   Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
2305 22 May 06 jari 72
2305 22 May 06 jari 73   String title = null;
2216 05 May 06 nicklas 74   final PlateEventType eventType = PlateEventType.getById(dc, itemId);
2216 05 May 06 nicklas 75   final PlateType plateType = eventType.getPlateType();
2305 22 May 06 jari 76   final int plateTypeId = plateType.getId();
2305 22 May 06 jari 77   
2305 22 May 06 jari 78   final boolean writePermission = eventType.hasPermission(Permission.WRITE);
2305 22 May 06 jari 79   final boolean deletePermission = eventType.hasPermission(Permission.DELETE);
4884 03 Apr 09 nicklas 80   JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, eventType);
7604 25 Feb 19 nicklas 81   ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext);
2305 22 May 06 jari 82   %>
6306 13 Aug 13 nicklas 83   <base:page title="<%=title%>" id="view-page">
6306 13 Aug 13 nicklas 84   <base:head scripts="table.js,tabcontrol-2.js,~eventtypes.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
4884 03 Apr 09 nicklas 85     <ext:scripts context="<%=jspContext%>" />
4884 03 Apr 09 nicklas 86     <ext:stylesheets context="<%=jspContext%>" />
2305 22 May 06 jari 87   </base:head>
2305 22 May 06 jari 88   <base:body>
5943 01 Feb 12 nicklas 89     <p:path><p:pathelement 
5943 01 Feb 12 nicklas 90       title="Plate types" href="<%="../index.jsp?ID="+ID%>" 
5943 01 Feb 12 nicklas 91       /><p:pathelement 
2305 22 May 06 jari 92         title="<%=HTML.encodeTags(plateType.getName())%>" 
6146 21 Sep 12 nicklas 93         href="<%="index.jsp?ID="+ID+"&amp;platetype_id="+plateTypeId%>"
5943 01 Feb 12 nicklas 94       /><p:pathelement title="<%=HTML.encodeTags(eventType.getName())%>" 
5943 01 Feb 12 nicklas 95       /></p:path>
6306 13 Aug 13 nicklas 96     <div id="page-data" data-item-id="<%=itemId%>" data-platetype-id="<%=plateTypeId%>"></div>
2305 22 May 06 jari 97     
5943 01 Feb 12 nicklas 98     <t:tabcontrol 
5943 01 Feb 12 nicklas 99       id="main" 
5943 01 Feb 12 nicklas 100       subclass="content mastertabcontrol" 
5943 01 Feb 12 nicklas 101       active="properties">
2305 22 May 06 jari 102     <t:tab id="properties" title="Properties">
5943 01 Feb 12 nicklas 103       <div>
5943 01 Feb 12 nicklas 104       <table class="fullform bottomborder">
2305 22 May 06 jari 105       <tr>
5943 01 Feb 12 nicklas 106         <th class="itemstatus"></th>
5943 01 Feb 12 nicklas 107         <td style="padding: 0px;">
6605 18 Nov 14 nicklas 108           <tbl:toolbar subclass="bottomborder bg-filled-50">
5943 01 Feb 12 nicklas 109             <tbl:button 
6306 13 Aug 13 nicklas 110               id="btnEdit"
5943 01 Feb 12 nicklas 111               disabled="<%=!writePermission%>" 
5945 02 Feb 12 nicklas 112               image="edit.png" 
5943 01 Feb 12 nicklas 113               title="Edit&hellip;" 
5943 01 Feb 12 nicklas 114               tooltip="<%=writePermission ? "Edit this event type" : "You do not have permission to edit this event type"%>" 
5943 01 Feb 12 nicklas 115             />
5943 01 Feb 12 nicklas 116             <tbl:button 
6306 13 Aug 13 nicklas 117               id="btnDelete"
6306 13 Aug 13 nicklas 118               data-confirm="1"
5943 01 Feb 12 nicklas 119               disabled="<%=!deletePermission%>" 
5946 03 Feb 12 nicklas 120               image="delete.png" 
5943 01 Feb 12 nicklas 121               title="Delete"
5943 01 Feb 12 nicklas 122               tooltip="<%=deletePermission ? "Delete this event type" : "You do not have permission to event this plate type"%>" 
5943 01 Feb 12 nicklas 123             />
5943 01 Feb 12 nicklas 124             <tbl:button 
6306 13 Aug 13 nicklas 125               id="btnImport"
5946 03 Feb 12 nicklas 126               image="import.png" 
6306 13 Aug 13 nicklas 127               data-plugin-type="IMPORT"
5943 01 Feb 12 nicklas 128               title="Import&hellip;" 
5943 01 Feb 12 nicklas 129               tooltip="Import data" 
5943 01 Feb 12 nicklas 130               visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
5943 01 Feb 12 nicklas 131             />
5943 01 Feb 12 nicklas 132             <tbl:button 
6306 13 Aug 13 nicklas 133               id="btnExport"
6306 13 Aug 13 nicklas 134               image="export.png"
6306 13 Aug 13 nicklas 135               data-plugin-type="EXPORT"
5943 01 Feb 12 nicklas 136               title="Export&hellip;" 
5943 01 Feb 12 nicklas 137               tooltip="Export data" 
5943 01 Feb 12 nicklas 138               visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
5943 01 Feb 12 nicklas 139             />
5943 01 Feb 12 nicklas 140             <tbl:button 
6306 13 Aug 13 nicklas 141               id="btnRunPlugin"
6306 13 Aug 13 nicklas 142               image="runplugin.png"  
6306 13 Aug 13 nicklas 143               data-plugin-type="OTHER" 
5943 01 Feb 12 nicklas 144               title="Run plugin&hellip;" 
5943 01 Feb 12 nicklas 145               tooltip="Run a plugin" 
5943 01 Feb 12 nicklas 146               visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
5943 01 Feb 12 nicklas 147             />
5943 01 Feb 12 nicklas 148             <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
7604 25 Feb 19 nicklas 149               wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/>
5943 01 Feb 12 nicklas 150               <tbl:button
5943 01 Feb 12 nicklas 151                 image="help.png"
6306 13 Aug 13 nicklas 152                 subclass="auto-init"
6306 13 Aug 13 nicklas 153                 data-auto-init="help"
6306 13 Aug 13 nicklas 154                 data-help-id="plateeventtype.view.properties"
5943 01 Feb 12 nicklas 155                 title="Help&hellip;"
5943 01 Feb 12 nicklas 156                 tooltip="Get help about this page"
5943 01 Feb 12 nicklas 157               />
5943 01 Feb 12 nicklas 158           </tbl:toolbar>
5943 01 Feb 12 nicklas 159         </td>
5943 01 Feb 12 nicklas 160       </tr>
5943 01 Feb 12 nicklas 161       <tr>
5943 01 Feb 12 nicklas 162         <th>Name</th>
2305 22 May 06 jari 163         <td><%=HTML.encodeTags(eventType.getName())%></td>
2305 22 May 06 jari 164       </tr>
2305 22 May 06 jari 165       <tr>
5943 01 Feb 12 nicklas 166         <th>Ordinal</th>
2305 22 May 06 jari 167         <td><%=eventType.getOrdinal()%></td>
2305 22 May 06 jari 168       </tr>
2305 22 May 06 jari 169       <tr>
5943 01 Feb 12 nicklas 170         <th>Protocol type</th>
2446 29 Jun 06 nicklas 171         <td><base:propertyvalue item="<%=eventType%>" property="protocolType" /></td>
2305 22 May 06 jari 172       </tr>
2305 22 May 06 jari 173       <tr>
5943 01 Feb 12 nicklas 174         <th>Permissions</th>
5943 01 Feb 12 nicklas 175         <td><%=PermissionUtil.getFullPermissionNames(eventType)%></td>
5943 01 Feb 12 nicklas 176       </tr>
5943 01 Feb 12 nicklas 177       <tr>
5943 01 Feb 12 nicklas 178         <th>Description</th>
2305 22 May 06 jari 179         <td><%=HTML.niceFormat(eventType.getDescription())%></td>
2305 22 May 06 jari 180       </tr>
2305 22 May 06 jari 181       </table>
5943 01 Feb 12 nicklas 182       </div>
5499 17 Nov 10 nicklas 183       <jsp:include page="../../../common/anytoany/list_anytoany.jsp">
5499 17 Nov 10 nicklas 184         <jsp:param name="ID" value="<%=ID%>" />
5499 17 Nov 10 nicklas 185         <jsp:param name="item_type" value="<%=itemType.name()%>" />
5499 17 Nov 10 nicklas 186         <jsp:param name="item_id" value="<%=itemId%>" />
5499 17 Nov 10 nicklas 187         <jsp:param name="title" value="Other items related to this event type" />
5499 17 Nov 10 nicklas 188       </jsp:include>
5943 01 Feb 12 nicklas 189     </t:tab>
5943 01 Feb 12 nicklas 190     </t:tabcontrol>
2305 22 May 06 jari 191   </base:body>
2305 22 May 06 jari 192   </base:page>
2305 22 May 06 jari 193   <%
2305 22 May 06 jari 194 }
2305 22 May 06 jari 195 finally
2305 22 May 06 jari 196 {
2305 22 May 06 jari 197   if (dc != null) dc.close();
2305 22 May 06 jari 198 }
2305 22 May 06 jari 199
2305 22 May 06 jari 200 %>