www/admin/plugintypes/view_plugintype.jsp

Code
Comments
Other
Rev Date Author Line
1991 15 Feb 06 nicklas 1 <%-- $Id$
1991 15 Feb 06 nicklas 2   ------------------------------------------------------------------
5425 23 Sep 10 nicklas 3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
1991 15 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/
1991 15 Feb 06 nicklas 7
1991 15 Feb 06 nicklas 8   BASE is free software; you can redistribute it and/or
1991 15 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
1991 15 Feb 06 nicklas 11   of the License, or (at your option) any later version.
1991 15 Feb 06 nicklas 12
1991 15 Feb 06 nicklas 13   BASE is distributed in the hope that it will be useful,
1991 15 Feb 06 nicklas 14   but WITHOUT ANY WARRANTY; without even the implied warranty of
1991 15 Feb 06 nicklas 15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1991 15 Feb 06 nicklas 16   GNU General Public License for more details.
1991 15 Feb 06 nicklas 17
1991 15 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/>.
1991 15 Feb 06 nicklas 20   ------------------------------------------------------------------
1991 15 Feb 06 nicklas 21
1991 15 Feb 06 nicklas 22   @author Nicklas
1991 15 Feb 06 nicklas 23   @version 2.0
1991 15 Feb 06 nicklas 24 --%>
5426 24 Sep 10 nicklas 25 <%@ page pageEncoding="UTF-8" session="false"
1991 15 Feb 06 nicklas 26   import="net.sf.basedb.core.SessionControl"
1991 15 Feb 06 nicklas 27   import="net.sf.basedb.core.DbControl"
1991 15 Feb 06 nicklas 28   import="net.sf.basedb.core.SystemItems"
1991 15 Feb 06 nicklas 29   import="net.sf.basedb.core.Item"
2436 28 Jun 06 nicklas 30   import="net.sf.basedb.core.Include"
1991 15 Feb 06 nicklas 31   import="net.sf.basedb.core.ItemContext"
1991 15 Feb 06 nicklas 32   import="net.sf.basedb.core.Permission"
1991 15 Feb 06 nicklas 33   import="net.sf.basedb.core.PluginType"
2436 28 Jun 06 nicklas 34   import="net.sf.basedb.core.ItemQuery"
2436 28 Jun 06 nicklas 35   import="net.sf.basedb.core.ItemResultList"
1991 15 Feb 06 nicklas 36   import="net.sf.basedb.core.PermissionDeniedException"
1991 15 Feb 06 nicklas 37   import="net.sf.basedb.core.PluginDefinition"
1991 15 Feb 06 nicklas 38   import="net.sf.basedb.core.plugin.GuiContext"
1991 15 Feb 06 nicklas 39   import="net.sf.basedb.core.plugin.Plugin"
2436 28 Jun 06 nicklas 40   import="net.sf.basedb.core.query.Restrictions"
2436 28 Jun 06 nicklas 41   import="net.sf.basedb.core.query.Hql"
2436 28 Jun 06 nicklas 42   import="net.sf.basedb.core.query.Orders"
1991 15 Feb 06 nicklas 43   import="net.sf.basedb.clients.web.Base"
2386 15 Jun 06 martin 44   import="net.sf.basedb.clients.web.PermissionUtil"
1991 15 Feb 06 nicklas 45   import="net.sf.basedb.clients.web.util.HTML"
2753 20 Oct 06 nicklas 46   import="net.sf.basedb.util.Values"
4698 10 Dec 08 nicklas 47   import="net.sf.basedb.util.formatter.Formatter"
4698 10 Dec 08 nicklas 48   import="net.sf.basedb.clients.web.formatter.FormatterFactory"
4886 03 Apr 09 nicklas 49   import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
4886 03 Apr 09 nicklas 50   import="net.sf.basedb.clients.web.extensions.JspContext"
4886 03 Apr 09 nicklas 51   import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
7604 25 Feb 19 nicklas 52   import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" 
4886 03 Apr 09 nicklas 53   import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
4886 03 Apr 09 nicklas 54   import="net.sf.basedb.util.extensions.ExtensionsInvoker"
4698 10 Dec 08 nicklas 55   import="java.util.Date"
1991 15 Feb 06 nicklas 56   import="java.util.Map"
1991 15 Feb 06 nicklas 57 %>
1991 15 Feb 06 nicklas 58 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
1991 15 Feb 06 nicklas 59 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
1991 15 Feb 06 nicklas 60 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
1991 15 Feb 06 nicklas 61 <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
4886 03 Apr 09 nicklas 62 <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
1991 15 Feb 06 nicklas 63 <%!
1991 15 Feb 06 nicklas 64   private static final Item itemType = Item.PLUGINTYPE;
1991 15 Feb 06 nicklas 65   private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
1991 15 Feb 06 nicklas 66 %>
1991 15 Feb 06 nicklas 67 <%
1991 15 Feb 06 nicklas 68 final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
1991 15 Feb 06 nicklas 69 final String ID = sc.getId();
1991 15 Feb 06 nicklas 70 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
1991 15 Feb 06 nicklas 71 final int itemId = cc.getId();
6289 05 Jun 13 nicklas 72 final String tab = Values.getStringOrNull(request.getParameter("tab"));
1991 15 Feb 06 nicklas 73 final float scale = Base.getScale(sc);
7954 12 May 21 nicklas 74 final DbControl dc = sc.newDbControl(":View "+itemType);
1991 15 Feb 06 nicklas 75 try
1991 15 Feb 06 nicklas 76 {
4698 10 Dec 08 nicklas 77   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
1991 15 Feb 06 nicklas 78   Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
1991 15 Feb 06 nicklas 79
1991 15 Feb 06 nicklas 80   String title = null;
1991 15 Feb 06 nicklas 81   PluginType pluginType = PluginType.getById(dc, itemId);
1991 15 Feb 06 nicklas 82   
1991 15 Feb 06 nicklas 83   final boolean writePermission = pluginType.hasPermission(Permission.WRITE);
1991 15 Feb 06 nicklas 84   final boolean deletePermission = pluginType.hasPermission(Permission.DELETE);
4003 26 Nov 07 nicklas 85   final boolean isRemoved = pluginType.isRemoved();
4003 26 Nov 07 nicklas 86   final boolean isUsed = isRemoved && pluginType.isUsed();
4003 26 Nov 07 nicklas 87   final boolean deletePermanentlyPermission = deletePermission && !isUsed;
4886 03 Apr 09 nicklas 88   JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, pluginType);
7604 25 Feb 19 nicklas 89   ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext);
1991 15 Feb 06 nicklas 90   %>
6289 05 Jun 13 nicklas 91   <base:page title="<%=title%>" id="view-page">
6289 05 Jun 13 nicklas 92   <base:head scripts="tabcontrol-2.js,~plugintypes.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css">
4886 03 Apr 09 nicklas 93     <ext:scripts context="<%=jspContext%>" />
4886 03 Apr 09 nicklas 94     <ext:stylesheets context="<%=jspContext%>" />
1991 15 Feb 06 nicklas 95   </base:head>
1991 15 Feb 06 nicklas 96   <base:body>
5941 01 Feb 12 nicklas 97     <p:path><p:pathelement 
5941 01 Feb 12 nicklas 98       title="Plugin types" href="<%="index.jsp?ID="+ID%>" 
5941 01 Feb 12 nicklas 99       /><p:pathelement title="<%=HTML.encodeTags(pluginType.getName())%>" 
5941 01 Feb 12 nicklas 100       /></p:path>
6289 05 Jun 13 nicklas 101     <div id="page-data" data-item-id="<%=itemId%>"></div>
1991 15 Feb 06 nicklas 102     
5941 01 Feb 12 nicklas 103     <t:tabcontrol 
5941 01 Feb 12 nicklas 104       id="main" 
5941 01 Feb 12 nicklas 105       subclass="content mastertabcontrol" 
6289 05 Jun 13 nicklas 106       active="<%=tab%>">
1991 15 Feb 06 nicklas 107     <t:tab id="properties" title="Properties">
5941 01 Feb 12 nicklas 108       <div>
5941 01 Feb 12 nicklas 109       <table class="fullform bottomborder">
5941 01 Feb 12 nicklas 110       <tr>
5941 01 Feb 12 nicklas 111         <th class="itemstatus">
4003 26 Nov 07 nicklas 112           <base:icon 
6289 05 Jun 13 nicklas 113             id="btnDeletePermanently"
5946 03 Feb 12 nicklas 114             image="deleted.png"
5941 01 Feb 12 nicklas 115             tooltip="This item has been flagged for deletion. Click to delete it now."
5941 01 Feb 12 nicklas 116             enabled="<%=deletePermanentlyPermission %>"
5941 01 Feb 12 nicklas 117             visible="<%=isRemoved%>" 
5941 01 Feb 12 nicklas 118           />
6289 05 Jun 13 nicklas 119           <base:icon
6289 05 Jun 13 nicklas 120             id="btnUsingItems"
6289 05 Jun 13 nicklas 121             image="used.png" 
5941 01 Feb 12 nicklas 122             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 123             visible="<%=isRemoved && isUsed%>" />
5941 01 Feb 12 nicklas 124         </th>
5941 01 Feb 12 nicklas 125         <td style="padding: 0px;">
6605 18 Nov 14 nicklas 126           <tbl:toolbar subclass="bottomborder bg-filled-50">
5941 01 Feb 12 nicklas 127             <tbl:button 
6289 05 Jun 13 nicklas 128               id="btnEdit"
5942 01 Feb 12 nicklas 129               disabled="<%=!writePermission%>" 
5945 02 Feb 12 nicklas 130               image="edit.png" 
5941 01 Feb 12 nicklas 131               title="Edit&hellip;" 
5941 01 Feb 12 nicklas 132               tooltip="<%=writePermission ? "Edit this plugin type" : "You do not have permission to edit this plugin type"%>" 
5941 01 Feb 12 nicklas 133             />
5941 01 Feb 12 nicklas 134             <tbl:button 
6289 05 Jun 13 nicklas 135               id="btnDelete"
5942 01 Feb 12 nicklas 136               disabled="<%=!deletePermission%>" 
5946 03 Feb 12 nicklas 137               image="delete.png" 
5941 01 Feb 12 nicklas 138               title="Delete"
5941 01 Feb 12 nicklas 139               visible="<%=!pluginType.isRemoved()%>"
5941 01 Feb 12 nicklas 140               tooltip="<%=deletePermission ? "Delete this plugin type" : "You do not have permission to delete this plugin type"%>" 
5941 01 Feb 12 nicklas 141             />
5941 01 Feb 12 nicklas 142             <tbl:button 
6289 05 Jun 13 nicklas 143               id="btnRestore"
5942 01 Feb 12 nicklas 144               disabled="<%=!writePermission%>" 
5946 03 Feb 12 nicklas 145               image="restore.png" 
5941 01 Feb 12 nicklas 146               title="Restore"
5941 01 Feb 12 nicklas 147               visible="<%=pluginType.isRemoved()%>"
5941 01 Feb 12 nicklas 148               tooltip="<%=writePermission ? "Restore this plugin type" : "You do not have permission to restore this plugin type"%>" 
5941 01 Feb 12 nicklas 149             />
5941 01 Feb 12 nicklas 150             <tbl:button 
6289 05 Jun 13 nicklas 151               id="btnImport"
5946 03 Feb 12 nicklas 152               image="import.png" 
6289 05 Jun 13 nicklas 153               data-plugin-type="IMPORT"  
5941 01 Feb 12 nicklas 154               title="Import&hellip;" 
5941 01 Feb 12 nicklas 155               tooltip="Import data" 
5941 01 Feb 12 nicklas 156               visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
5941 01 Feb 12 nicklas 157             />
5941 01 Feb 12 nicklas 158             <tbl:button 
6289 05 Jun 13 nicklas 159               id="btnExport"
6289 05 Jun 13 nicklas 160               image="export.png"
6289 05 Jun 13 nicklas 161               data-plugin-type="EXPORT" 
5941 01 Feb 12 nicklas 162               title="Export&hellip;" 
5941 01 Feb 12 nicklas 163               tooltip="Export data" 
5941 01 Feb 12 nicklas 164               visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
5941 01 Feb 12 nicklas 165             />
5941 01 Feb 12 nicklas 166             <tbl:button 
6289 05 Jun 13 nicklas 167               id="btnRunPlugin"
6289 05 Jun 13 nicklas 168               image="runplugin.png"  
6289 05 Jun 13 nicklas 169               data-plugin-type="OTHER" 
5941 01 Feb 12 nicklas 170               title="Run plugin&hellip;" 
5941 01 Feb 12 nicklas 171               tooltip="Run a plugin" 
5941 01 Feb 12 nicklas 172               visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
5941 01 Feb 12 nicklas 173             />
5941 01 Feb 12 nicklas 174             <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
7604 25 Feb 19 nicklas 175               wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/>
5941 01 Feb 12 nicklas 176             <tbl:button
5941 01 Feb 12 nicklas 177               image="help.png"
6289 05 Jun 13 nicklas 178               subclass="auto-init"
6289 05 Jun 13 nicklas 179               data-auto-init="help"
6289 05 Jun 13 nicklas 180               data-help-id="plugintype.view.properties"
5941 01 Feb 12 nicklas 181               title="Help&hellip;"
5941 01 Feb 12 nicklas 182               tooltip="Get help about this page"
5941 01 Feb 12 nicklas 183             />
5941 01 Feb 12 nicklas 184           </tbl:toolbar>
5941 01 Feb 12 nicklas 185         </td>
5941 01 Feb 12 nicklas 186       </tr>
1991 15 Feb 06 nicklas 187       <tr>
5941 01 Feb 12 nicklas 188         <th>Name</th>
1991 15 Feb 06 nicklas 189         <td><%=HTML.encodeTags(pluginType.getName())%></td>
1991 15 Feb 06 nicklas 190       </tr>
1991 15 Feb 06 nicklas 191       <tr>
5941 01 Feb 12 nicklas 192         <th>Registered</th>
4698 10 Dec 08 nicklas 193         <td><%=dateFormatter.format(pluginType.getEntryDate())%></td>
4698 10 Dec 08 nicklas 194       </tr>
4698 10 Dec 08 nicklas 195       <tr>
5941 01 Feb 12 nicklas 196         <th>Interface</th>
1991 15 Feb 06 nicklas 197         <td><%=HTML.encodeTags(pluginType.getInterfaceName())%></td>
1991 15 Feb 06 nicklas 198       </tr>
1991 15 Feb 06 nicklas 199       <tr>
5941 01 Feb 12 nicklas 200         <th>JAR file</th>
5613 18 Apr 11 nicklas 201         <td><%=Values.getString(pluginType.getJarFile(), "<i>- internal -</i>")%></td>
1991 15 Feb 06 nicklas 202       </tr>
1991 15 Feb 06 nicklas 203       <tr>
5941 01 Feb 12 nicklas 204         <th>Permissions</th>
5941 01 Feb 12 nicklas 205         <td><%=PermissionUtil.getFullPermissionNames(pluginType)%></td>
5941 01 Feb 12 nicklas 206       </tr>
5941 01 Feb 12 nicklas 207       <tr>
5941 01 Feb 12 nicklas 208         <th>Description</th>
1991 15 Feb 06 nicklas 209         <td><%=HTML.niceFormat(pluginType.getDescription())%></td>
1991 15 Feb 06 nicklas 210       </tr>
1991 15 Feb 06 nicklas 211       </table>
5941 01 Feb 12 nicklas 212       </div>
2436 28 Jun 06 nicklas 213       <%
2436 28 Jun 06 nicklas 214       ItemQuery<PluginDefinition> pluginQuery = pluginType.getPlugins();
3890 30 Oct 07 nicklas 215       pluginQuery.include(Include.ALL);
2436 28 Jun 06 nicklas 216       pluginQuery.order(Orders.asc(Hql.property("name")));
2436 28 Jun 06 nicklas 217       ItemResultList<PluginDefinition> plugins = pluginQuery.list(dc);
5941 01 Feb 12 nicklas 218       %>
5941 01 Feb 12 nicklas 219       <base:section
5941 01 Feb 12 nicklas 220         id="plugins"
5941 01 Feb 12 nicklas 221         title="<%="Plugins (" + plugins.size() + ")"%>"
5941 01 Feb 12 nicklas 222         context="<%=cc%>"
5941 01 Feb 12 nicklas 223         >
2436 28 Jun 06 nicklas 224         <%
5941 01 Feb 12 nicklas 225         if (plugins.size() == 0)
5941 01 Feb 12 nicklas 226         {
5941 01 Feb 12 nicklas 227           %>
5941 01 Feb 12 nicklas 228           <div class="messagecontainer note">
5941 01 Feb 12 nicklas 229           There are no plugins of this type (or, you don't have permission to view them).
5941 01 Feb 12 nicklas 230           </div>
5941 01 Feb 12 nicklas 231           <%
5941 01 Feb 12 nicklas 232         }
5941 01 Feb 12 nicklas 233         else
5941 01 Feb 12 nicklas 234         {
5941 01 Feb 12 nicklas 235           %>
5040 10 Aug 09 martin 236           <tbl:table
6147 21 Sep 12 nicklas 237             id="tbl.plugins"
5040 10 Aug 09 martin 238             columns="all"
5040 10 Aug 09 martin 239             >
5040 10 Aug 09 martin 240           <tbl:columndef 
5040 10 Aug 09 martin 241             id="name"
5040 10 Aug 09 martin 242             title="Name"
5040 10 Aug 09 martin 243           />
5040 10 Aug 09 martin 244           <tbl:columndef 
5040 10 Aug 09 martin 245             id="class"
5040 10 Aug 09 martin 246             title="Class"
5040 10 Aug 09 martin 247           />
5040 10 Aug 09 martin 248           <tbl:columndef 
5040 10 Aug 09 martin 249             id="description"
5040 10 Aug 09 martin 250             title="Description"
5040 10 Aug 09 martin 251           />
5040 10 Aug 09 martin 252           <tbl:data>
5941 01 Feb 12 nicklas 253             <tbl:headers>
5941 01 Feb 12 nicklas 254               <tbl:headerrow>
5941 01 Feb 12 nicklas 255                 <tbl:columnheaders />
5941 01 Feb 12 nicklas 256               </tbl:headerrow>
5941 01 Feb 12 nicklas 257             </tbl:headers>
5040 10 Aug 09 martin 258             <tbl:rows>
5040 10 Aug 09 martin 259             <%
5040 10 Aug 09 martin 260             for (PluginDefinition plugin : plugins)
5040 10 Aug 09 martin 261             {
5040 10 Aug 09 martin 262               %>
5040 10 Aug 09 martin 263               <tbl:row>
5040 10 Aug 09 martin 264                 <tbl:cell column="name"><base:icon 
5946 03 Feb 12 nicklas 265                     image="deleted.png" 
5040 10 Aug 09 martin 266                     tooltip="This item has been scheduled for deletion" 
5040 10 Aug 09 martin 267                     visible="<%=plugin.isRemoved()%>"
5610 15 Apr 11 nicklas 268                   /><%=Base.getLinkedName(ID, plugin, false, true)%></tbl:cell>
5040 10 Aug 09 martin 269                 <tbl:cell column="class"><%=HTML.encodeTags(plugin.getClassName())%></tbl:cell>
5040 10 Aug 09 martin 270                 <tbl:cell column="description"><%=HTML.encodeTags(plugin.getDescription())%></tbl:cell>
5040 10 Aug 09 martin 271               </tbl:row>
5040 10 Aug 09 martin 272               <%
5040 10 Aug 09 martin 273             }
2436 28 Jun 06 nicklas 274             %>
5040 10 Aug 09 martin 275             </tbl:rows>
5040 10 Aug 09 martin 276           </tbl:data>
5040 10 Aug 09 martin 277           </tbl:table>
5941 01 Feb 12 nicklas 278           <%
5941 01 Feb 12 nicklas 279         }
5941 01 Feb 12 nicklas 280         %>
5941 01 Feb 12 nicklas 281       </base:section>
5509 19 Nov 10 nicklas 282       <jsp:include page="../../common/anytoany/list_anytoany.jsp">
5509 19 Nov 10 nicklas 283         <jsp:param name="ID" value="<%=ID%>" />
5509 19 Nov 10 nicklas 284         <jsp:param name="item_type" value="<%=itemType.name()%>" />
5509 19 Nov 10 nicklas 285         <jsp:param name="item_id" value="<%=itemId%>" />
5509 19 Nov 10 nicklas 286         <jsp:param name="title" value="Other items related to this plugin type" />
5509 19 Nov 10 nicklas 287       </jsp:include>
5941 01 Feb 12 nicklas 288     </t:tab>
5941 01 Feb 12 nicklas 289     </t:tabcontrol>
1991 15 Feb 06 nicklas 290   </base:body>
1991 15 Feb 06 nicklas 291   </base:page>
1991 15 Feb 06 nicklas 292   <%
1991 15 Feb 06 nicklas 293 }
1991 15 Feb 06 nicklas 294 finally
1991 15 Feb 06 nicklas 295 {
1991 15 Feb 06 nicklas 296   if (dc != null) dc.close();
1991 15 Feb 06 nicklas 297 }
1991 15 Feb 06 nicklas 298
1991 15 Feb 06 nicklas 299 %>