www/admin/reportertypes/view_reportertype.jsp

Code
Comments
Other
Rev Date Author Line
1998 16 Feb 06 nicklas 1 <%-- $Id$
1998 16 Feb 06 nicklas 2   ------------------------------------------------------------------
5425 23 Sep 10 nicklas 3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
1998 16 Feb 06 nicklas 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/
1998 16 Feb 06 nicklas 7
1998 16 Feb 06 nicklas 8   BASE is free software; you can redistribute it and/or
1998 16 Feb 06 nicklas 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
1998 16 Feb 06 nicklas 11   of the License, or (at your option) any later version.
1998 16 Feb 06 nicklas 12
1998 16 Feb 06 nicklas 13   BASE is distributed in the hope that it will be useful,
1998 16 Feb 06 nicklas 14   but WITHOUT ANY WARRANTY; without even the implied warranty of
1998 16 Feb 06 nicklas 15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1998 16 Feb 06 nicklas 16   GNU General Public License for more details.
1998 16 Feb 06 nicklas 17
1998 16 Feb 06 nicklas 18   You should have received a copy of the GNU General Public License
4510 11 Sep 08 jari 19   along with BASE. If not, see <http://www.gnu.org/licenses/>.
1998 16 Feb 06 nicklas 20   ------------------------------------------------------------------
1998 16 Feb 06 nicklas 21
1998 16 Feb 06 nicklas 22   @author Nicklas
1998 16 Feb 06 nicklas 23   @version 2.0
1998 16 Feb 06 nicklas 24 --%>
5426 24 Sep 10 nicklas 25 <%@ page pageEncoding="UTF-8" session="false"
1998 16 Feb 06 nicklas 26   import="net.sf.basedb.core.SessionControl"
1998 16 Feb 06 nicklas 27   import="net.sf.basedb.core.DbControl"
1998 16 Feb 06 nicklas 28   import="net.sf.basedb.core.SystemItems"
1998 16 Feb 06 nicklas 29   import="net.sf.basedb.core.Item"
1998 16 Feb 06 nicklas 30   import="net.sf.basedb.core.ItemContext"
1998 16 Feb 06 nicklas 31   import="net.sf.basedb.core.Permission"
1998 16 Feb 06 nicklas 32   import="net.sf.basedb.core.ReporterType"
1998 16 Feb 06 nicklas 33   import="net.sf.basedb.core.PermissionDeniedException"
1998 16 Feb 06 nicklas 34   import="net.sf.basedb.core.PluginDefinition"
1998 16 Feb 06 nicklas 35   import="net.sf.basedb.core.plugin.GuiContext"
1998 16 Feb 06 nicklas 36   import="net.sf.basedb.core.plugin.Plugin"
1998 16 Feb 06 nicklas 37   import="net.sf.basedb.clients.web.Base"
2386 15 Jun 06 martin 38   import="net.sf.basedb.clients.web.PermissionUtil"
1998 16 Feb 06 nicklas 39   import="net.sf.basedb.clients.web.util.HTML"
2753 20 Oct 06 nicklas 40   import="net.sf.basedb.util.Values"
4698 10 Dec 08 nicklas 41   import="net.sf.basedb.util.formatter.Formatter"
4698 10 Dec 08 nicklas 42   import="net.sf.basedb.clients.web.formatter.FormatterFactory"
4886 03 Apr 09 nicklas 43   import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
4886 03 Apr 09 nicklas 44   import="net.sf.basedb.clients.web.extensions.JspContext"
4886 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" 
4886 03 Apr 09 nicklas 47   import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
4886 03 Apr 09 nicklas 48   import="net.sf.basedb.util.extensions.ExtensionsInvoker"
4698 10 Dec 08 nicklas 49   import="java.util.Date"
1998 16 Feb 06 nicklas 50   import="java.util.Map"
1998 16 Feb 06 nicklas 51 %>
1998 16 Feb 06 nicklas 52 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
1998 16 Feb 06 nicklas 53 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
1998 16 Feb 06 nicklas 54 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
1998 16 Feb 06 nicklas 55 <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
4886 03 Apr 09 nicklas 56 <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
1998 16 Feb 06 nicklas 57 <%!
1998 16 Feb 06 nicklas 58   private static final Item itemType = Item.REPORTERTYPE;
1998 16 Feb 06 nicklas 59   private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
1998 16 Feb 06 nicklas 60 %>
1998 16 Feb 06 nicklas 61 <%
1998 16 Feb 06 nicklas 62 final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
1998 16 Feb 06 nicklas 63 final String ID = sc.getId();
1998 16 Feb 06 nicklas 64 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
1998 16 Feb 06 nicklas 65 final int itemId = cc.getId();
6289 05 Jun 13 nicklas 66 final String tab = Values.getStringOrNull(request.getParameter("tab"));
1998 16 Feb 06 nicklas 67 final float scale = Base.getScale(sc);
7954 12 May 21 nicklas 68 final DbControl dc = sc.newDbControl(":View "+itemType);
1998 16 Feb 06 nicklas 69 try
1998 16 Feb 06 nicklas 70 {
4698 10 Dec 08 nicklas 71   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
1998 16 Feb 06 nicklas 72   Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
1998 16 Feb 06 nicklas 73
1998 16 Feb 06 nicklas 74   String title = null;
1998 16 Feb 06 nicklas 75   ReporterType reporterType = ReporterType.getById(dc, itemId);
1998 16 Feb 06 nicklas 76   
1998 16 Feb 06 nicklas 77   final boolean writePermission = reporterType.hasPermission(Permission.WRITE);
1998 16 Feb 06 nicklas 78   final boolean deletePermission = reporterType.hasPermission(Permission.DELETE);
4003 26 Nov 07 nicklas 79   final boolean isRemoved = reporterType.isRemoved();
4003 26 Nov 07 nicklas 80   final boolean isUsed = isRemoved && reporterType.isUsed();
4003 26 Nov 07 nicklas 81   final boolean deletePermanentlyPermission = deletePermission && !isUsed;
4886 03 Apr 09 nicklas 82   JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, reporterType);
7604 25 Feb 19 nicklas 83   ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext);
1998 16 Feb 06 nicklas 84   %>
6289 05 Jun 13 nicklas 85   <base:page title="<%=title%>" id="view-page">
6289 05 Jun 13 nicklas 86   <base:head scripts="tabcontrol-2.js,table.js,~reportertypes.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css">
4886 03 Apr 09 nicklas 87     <ext:scripts context="<%=jspContext%>" />
4886 03 Apr 09 nicklas 88     <ext:stylesheets context="<%=jspContext%>" />
1998 16 Feb 06 nicklas 89   </base:head>
1998 16 Feb 06 nicklas 90   <base:body>
5941 01 Feb 12 nicklas 91     <p:path><p:pathelement 
5941 01 Feb 12 nicklas 92       title="Reporter types" href="<%="index.jsp?ID="+ID%>" 
5941 01 Feb 12 nicklas 93       /><p:pathelement title="<%=HTML.encodeTags(reporterType.getName())%>" 
5941 01 Feb 12 nicklas 94       /></p:path>
6289 05 Jun 13 nicklas 95     <div id="page-data" data-item-id="<%=itemId%>"></div>
1998 16 Feb 06 nicklas 96     
5941 01 Feb 12 nicklas 97     <t:tabcontrol 
5941 01 Feb 12 nicklas 98       id="main"
5941 01 Feb 12 nicklas 99       subclass="content mastertabcontrol" 
6289 05 Jun 13 nicklas 100       active="<%=tab%>">
1998 16 Feb 06 nicklas 101     <t:tab id="properties" title="Properties">
5941 01 Feb 12 nicklas 102       <div>
5941 01 Feb 12 nicklas 103       <table class="fullform bottomborder">
5941 01 Feb 12 nicklas 104       <tr>
5941 01 Feb 12 nicklas 105         <th class="itemstatus">
4003 26 Nov 07 nicklas 106           <base:icon 
6289 05 Jun 13 nicklas 107             id="btnDeletePermanently"
5946 03 Feb 12 nicklas 108             image="deleted.png"
5941 01 Feb 12 nicklas 109             tooltip="This item has been flagged for deletion. Click to delete it now."
5941 01 Feb 12 nicklas 110             enabled="<%=deletePermanentlyPermission %>"
5941 01 Feb 12 nicklas 111             visible="<%=isRemoved%>" 
5941 01 Feb 12 nicklas 112           />
6289 05 Jun 13 nicklas 113           <base:icon
6289 05 Jun 13 nicklas 114             id="btnUsingItems"
6289 05 Jun 13 nicklas 115             image="used.png" 
5941 01 Feb 12 nicklas 116             tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one"
5941 01 Feb 12 nicklas 117             visible="<%=isRemoved && isUsed%>" />
5941 01 Feb 12 nicklas 118         </th>
5941 01 Feb 12 nicklas 119         <td style="padding: 0px;">
6605 18 Nov 14 nicklas 120           <tbl:toolbar subclass="bottomborder bg-filled-50">
5941 01 Feb 12 nicklas 121             <tbl:button 
6289 05 Jun 13 nicklas 122               id="btnEdit"
5942 01 Feb 12 nicklas 123               disabled="<%=!writePermission%>" 
5945 02 Feb 12 nicklas 124               image="edit.png" 
5941 01 Feb 12 nicklas 125               title="Edit&hellip;" 
5941 01 Feb 12 nicklas 126               tooltip="<%=writePermission ? "Edit this reporter type" : "You do not have permission to edit this reporter type"%>" 
5941 01 Feb 12 nicklas 127             />
5941 01 Feb 12 nicklas 128             <tbl:button 
6289 05 Jun 13 nicklas 129               id="btnDelete"
5942 01 Feb 12 nicklas 130               disabled="<%=!deletePermission%>" 
5946 03 Feb 12 nicklas 131               image="delete.png" 
5941 01 Feb 12 nicklas 132               title="Delete"
5941 01 Feb 12 nicklas 133               visible="<%=!reporterType.isRemoved()%>"
5941 01 Feb 12 nicklas 134               tooltip="<%=deletePermission ? "Delete this protocol type" : "You do not have permission to delete this reporter type"%>" 
5941 01 Feb 12 nicklas 135             />
5941 01 Feb 12 nicklas 136             <tbl:button 
6289 05 Jun 13 nicklas 137               id="btnRestore"
5942 01 Feb 12 nicklas 138               disabled="<%=!writePermission%>" 
5946 03 Feb 12 nicklas 139               image="restore.png" 
5941 01 Feb 12 nicklas 140               title="Restore"
5941 01 Feb 12 nicklas 141               visible="<%=reporterType.isRemoved()%>"
5941 01 Feb 12 nicklas 142               tooltip="<%=writePermission ? "Restore this reporter type" : "You do not have permission to restore this reporter type"%>" 
5941 01 Feb 12 nicklas 143             />
5941 01 Feb 12 nicklas 144             <tbl:button 
6289 05 Jun 13 nicklas 145               id="btnImport"
5946 03 Feb 12 nicklas 146               image="import.png" 
6289 05 Jun 13 nicklas 147               data-plugin-type="IMPORT"  
5941 01 Feb 12 nicklas 148               title="Import&hellip;" 
5941 01 Feb 12 nicklas 149               tooltip="Import data" 
5941 01 Feb 12 nicklas 150               visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
5941 01 Feb 12 nicklas 151             />
5941 01 Feb 12 nicklas 152             <tbl:button 
6289 05 Jun 13 nicklas 153               id="btnExport"
6289 05 Jun 13 nicklas 154               image="export.png"
6289 05 Jun 13 nicklas 155               data-plugin-type="EXPORT" 
5941 01 Feb 12 nicklas 156               title="Export&hellip;" 
5941 01 Feb 12 nicklas 157               tooltip="Export data" 
5941 01 Feb 12 nicklas 158               visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
5941 01 Feb 12 nicklas 159             />
5941 01 Feb 12 nicklas 160             <tbl:button 
6289 05 Jun 13 nicklas 161               id="btnRunPlugin"
6289 05 Jun 13 nicklas 162               image="runplugin.png"  
6289 05 Jun 13 nicklas 163               data-plugin-type="OTHER" 
5941 01 Feb 12 nicklas 164               title="Run plugin&hellip;" 
5941 01 Feb 12 nicklas 165               tooltip="Run a plugin" 
5941 01 Feb 12 nicklas 166               visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
5941 01 Feb 12 nicklas 167             />
5941 01 Feb 12 nicklas 168             <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
7604 25 Feb 19 nicklas 169               wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/>
5941 01 Feb 12 nicklas 170             <tbl:button
5941 01 Feb 12 nicklas 171               image="help.png"
6289 05 Jun 13 nicklas 172               subclass="auto-init"
6289 05 Jun 13 nicklas 173               data-auto-init="help"
6289 05 Jun 13 nicklas 174               data-help-id="reportertype.view.properties"
5941 01 Feb 12 nicklas 175               title="Help&hellip;"
5941 01 Feb 12 nicklas 176               tooltip="Get help about this page"
5941 01 Feb 12 nicklas 177             />
5941 01 Feb 12 nicklas 178           </tbl:toolbar>
5941 01 Feb 12 nicklas 179         </td>
5941 01 Feb 12 nicklas 180       </tr>
1998 16 Feb 06 nicklas 181       <tr>
5941 01 Feb 12 nicklas 182         <th>Name</th>
1998 16 Feb 06 nicklas 183         <td><%=HTML.encodeTags(reporterType.getName())%></td>
1998 16 Feb 06 nicklas 184       </tr>
1998 16 Feb 06 nicklas 185       <tr>
5941 01 Feb 12 nicklas 186         <th>Registered</th>
4698 10 Dec 08 nicklas 187         <td><%=dateFormatter.format(reporterType.getEntryDate())%></td>
4698 10 Dec 08 nicklas 188       </tr>
4698 10 Dec 08 nicklas 189       <tr>
5941 01 Feb 12 nicklas 190         <th>Permissions</th>
5941 01 Feb 12 nicklas 191         <td><%=PermissionUtil.getFullPermissionNames(reporterType)%></td>
5941 01 Feb 12 nicklas 192       </tr>
5941 01 Feb 12 nicklas 193       <tr>
5941 01 Feb 12 nicklas 194         <th>Description</th>
1998 16 Feb 06 nicklas 195         <td><%=HTML.niceFormat(reporterType.getDescription())%></td>
1998 16 Feb 06 nicklas 196       </tr>
1998 16 Feb 06 nicklas 197       </table>
5941 01 Feb 12 nicklas 198       </div>
5511 19 Nov 10 nicklas 199       <jsp:include page="../../common/anytoany/list_anytoany.jsp">
5511 19 Nov 10 nicklas 200         <jsp:param name="ID" value="<%=ID%>" />
5511 19 Nov 10 nicklas 201         <jsp:param name="item_type" value="<%=itemType.name()%>" />
5511 19 Nov 10 nicklas 202         <jsp:param name="item_id" value="<%=itemId%>" />
5511 19 Nov 10 nicklas 203         <jsp:param name="title" value="Other items related to this reporter type" />
5511 19 Nov 10 nicklas 204       </jsp:include>
1998 16 Feb 06 nicklas 205       </t:tab>
1998 16 Feb 06 nicklas 206       </t:tabcontrol>
1998 16 Feb 06 nicklas 207
1998 16 Feb 06 nicklas 208   </base:body>
1998 16 Feb 06 nicklas 209   </base:page>
1998 16 Feb 06 nicklas 210   <%
1998 16 Feb 06 nicklas 211 }
1998 16 Feb 06 nicklas 212 finally
1998 16 Feb 06 nicklas 213 {
1998 16 Feb 06 nicklas 214   if (dc != null) dc.close();
1998 16 Feb 06 nicklas 215 }
1998 16 Feb 06 nicklas 216
1998 16 Feb 06 nicklas 217 %>