www/biomaterials/tags/view_tag.jsp

Code
Comments
Other
Rev Date Author Line
1864 30 Jan 06 nicklas 1 <%-- $Id$
1864 30 Jan 06 nicklas 2   ------------------------------------------------------------------
5425 23 Sep 10 nicklas 3   Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
3675 16 Aug 07 jari 4   Copyright (C) 2007 Martin Svensson
1864 30 Jan 06 nicklas 5
2304 22 May 06 jari 6   This file is part of BASE - BioArray Software Environment.
2304 22 May 06 jari 7   Available at http://base.thep.lu.se/
1864 30 Jan 06 nicklas 8
1864 30 Jan 06 nicklas 9   BASE is free software; you can redistribute it and/or
1864 30 Jan 06 nicklas 10   modify it under the terms of the GNU General Public License
4476 05 Sep 08 jari 11   as published by the Free Software Foundation; either version 3
1864 30 Jan 06 nicklas 12   of the License, or (at your option) any later version.
1864 30 Jan 06 nicklas 13
1864 30 Jan 06 nicklas 14   BASE is distributed in the hope that it will be useful,
1864 30 Jan 06 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
1864 30 Jan 06 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1864 30 Jan 06 nicklas 17   GNU General Public License for more details.
1864 30 Jan 06 nicklas 18
1864 30 Jan 06 nicklas 19   You should have received a copy of the GNU General Public License
4510 11 Sep 08 jari 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
1864 30 Jan 06 nicklas 21   ------------------------------------------------------------------
1864 30 Jan 06 nicklas 22
1864 30 Jan 06 nicklas 23   @author Nicklas
1864 30 Jan 06 nicklas 24   @version 2.0
1864 30 Jan 06 nicklas 25 --%>
5426 24 Sep 10 nicklas 26 <%@ page pageEncoding="UTF-8" session="false"
1864 30 Jan 06 nicklas 27   import="net.sf.basedb.core.SessionControl"
1864 30 Jan 06 nicklas 28   import="net.sf.basedb.core.DbControl"
1864 30 Jan 06 nicklas 29   import="net.sf.basedb.core.SystemItems"
3547 03 Jul 07 martin 30   import="net.sf.basedb.core.Group"
2466 06 Jul 06 martin 31   import="net.sf.basedb.core.Include"
1864 30 Jan 06 nicklas 32   import="net.sf.basedb.core.Item"
1864 30 Jan 06 nicklas 33   import="net.sf.basedb.core.ItemContext"
2466 06 Jul 06 martin 34   import="net.sf.basedb.core.ItemQuery"
2466 06 Jul 06 martin 35   import="net.sf.basedb.core.ItemResultList"
1864 30 Jan 06 nicklas 36   import="net.sf.basedb.core.Permission"
5632 17 May 11 nicklas 37   import="net.sf.basedb.core.Tag"
3547 03 Jul 07 martin 38   import="net.sf.basedb.core.MultiPermissions"
1864 30 Jan 06 nicklas 39   import="net.sf.basedb.core.User"
1864 30 Jan 06 nicklas 40   import="net.sf.basedb.core.PermissionDeniedException"
1864 30 Jan 06 nicklas 41   import="net.sf.basedb.core.PluginDefinition"
1864 30 Jan 06 nicklas 42   import="net.sf.basedb.core.plugin.GuiContext"
1864 30 Jan 06 nicklas 43   import="net.sf.basedb.core.plugin.Plugin"
3547 03 Jul 07 martin 44   import="net.sf.basedb.core.Project"
2466 06 Jul 06 martin 45   import="net.sf.basedb.core.query.Orders"
2466 06 Jul 06 martin 46   import="net.sf.basedb.core.query.Hql"
1864 30 Jan 06 nicklas 47   import="net.sf.basedb.clients.web.Base"
6362 28 Nov 13 olle 48   import="net.sf.basedb.clients.web.ChangeHistoryUtil"
2386 15 Jun 06 martin 49   import="net.sf.basedb.clients.web.PermissionUtil"
1864 30 Jan 06 nicklas 50   import="net.sf.basedb.clients.web.util.HTML"
2753 20 Oct 06 nicklas 51   import="net.sf.basedb.util.Values"
4698 10 Dec 08 nicklas 52   import="net.sf.basedb.util.formatter.Formatter"
4698 10 Dec 08 nicklas 53   import="net.sf.basedb.clients.web.formatter.FormatterFactory"
4882 03 Apr 09 nicklas 54   import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
4882 03 Apr 09 nicklas 55   import="net.sf.basedb.clients.web.extensions.JspContext"
4882 03 Apr 09 nicklas 56   import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
7604 25 Feb 19 nicklas 57   import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" 
4882 03 Apr 09 nicklas 58   import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
4882 03 Apr 09 nicklas 59   import="net.sf.basedb.util.extensions.ExtensionsInvoker"
4698 10 Dec 08 nicklas 60   import="java.util.Date"
3547 03 Jul 07 martin 61   import="java.util.Collections"
1864 30 Jan 06 nicklas 62   import="java.util.Map"
3547 03 Jul 07 martin 63   import="java.util.Set"
1864 30 Jan 06 nicklas 64 %>
1864 30 Jan 06 nicklas 65 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
1864 30 Jan 06 nicklas 66 <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
1864 30 Jan 06 nicklas 67 <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
1864 30 Jan 06 nicklas 68 <%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
4882 03 Apr 09 nicklas 69 <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
1864 30 Jan 06 nicklas 70 <%!
5632 17 May 11 nicklas 71   private static final Item itemType = Item.TAG;
1864 30 Jan 06 nicklas 72   private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
1864 30 Jan 06 nicklas 73 %>
1864 30 Jan 06 nicklas 74 <%
1864 30 Jan 06 nicklas 75 final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
1864 30 Jan 06 nicklas 76 final String ID = sc.getId();
1864 30 Jan 06 nicklas 77 final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
1864 30 Jan 06 nicklas 78 final int itemId = cc.getId();
6261 27 Mar 13 nicklas 79 final String tab = Values.getStringOrNull(request.getParameter("tab"));
1864 30 Jan 06 nicklas 80 final float scale = Base.getScale(sc);
7954 12 May 21 nicklas 81 final DbControl dc = sc.newDbControl(":View "+itemType);
1864 30 Jan 06 nicklas 82 try
1864 30 Jan 06 nicklas 83 {
4698 10 Dec 08 nicklas 84   Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
1864 30 Jan 06 nicklas 85   Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
1864 30 Jan 06 nicklas 86
1864 30 Jan 06 nicklas 87   String title = null;
5632 17 May 11 nicklas 88   Tag tag = Tag.getById(dc, itemId);
1864 30 Jan 06 nicklas 89   
5632 17 May 11 nicklas 90   final boolean writePermission = tag.hasPermission(Permission.WRITE);
5632 17 May 11 nicklas 91   final boolean deletePermission = tag.hasPermission(Permission.DELETE);
5632 17 May 11 nicklas 92   final boolean sharePermission = tag.hasPermission(Permission.SET_PERMISSION);
5632 17 May 11 nicklas 93   final boolean usePermission = tag.hasPermission(Permission.USE);
5632 17 May 11 nicklas 94   final boolean setOwnerPermission = tag.hasPermission(Permission.SET_OWNER);
5632 17 May 11 nicklas 95   final boolean isRemoved = tag.isRemoved();
5632 17 May 11 nicklas 96   final boolean isUsed = isRemoved && tag.isUsed();
4003 26 Nov 07 nicklas 97   final boolean deletePermanentlyPermission = deletePermission && !isUsed;
5632 17 May 11 nicklas 98   final boolean isOwner = tag.isOwner();
5632 17 May 11 nicklas 99   JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, tag);
7604 25 Feb 19 nicklas 100   ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext);
1864 30 Jan 06 nicklas 101   %>
6261 27 Mar 13 nicklas 102   <base:page title="<%=title%>" id="view-page">
6261 27 Mar 13 nicklas 103   <base:head scripts="table.js,tabcontrol-2.js,~tags.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
4882 03 Apr 09 nicklas 104     <ext:scripts context="<%=jspContext%>" />
4882 03 Apr 09 nicklas 105     <ext:stylesheets context="<%=jspContext%>" />
1864 30 Jan 06 nicklas 106   </base:head>
1864 30 Jan 06 nicklas 107   <base:body>
5935 26 Jan 12 nicklas 108     <p:path><p:pathelement 
5935 26 Jan 12 nicklas 109       title="Tags" href="<%="index.jsp?ID="+ID%>" /><p:pathelement 
5935 26 Jan 12 nicklas 110       title="<%=HTML.encodeTags(tag.getName())%>" /></p:path>
6261 27 Mar 13 nicklas 111     <div id="page-data" data-item-id="<%=itemId%>"></div>
1864 30 Jan 06 nicklas 112     
5939 30 Jan 12 nicklas 113     <t:tabcontrol 
5939 30 Jan 12 nicklas 114       id="main" 
5939 30 Jan 12 nicklas 115       subclass="content mastertabcontrol" 
6261 27 Mar 13 nicklas 116       active="<%=tab%>">
1864 30 Jan 06 nicklas 117     <t:tab id="properties" title="Properties">
5935 26 Jan 12 nicklas 118       <div>
5935 26 Jan 12 nicklas 119       <table class="fullform bottomborder">
1864 30 Jan 06 nicklas 120       <tr>
5935 26 Jan 12 nicklas 121         <th class="itemstatus">
5937 27 Jan 12 nicklas 122           <base:icon 
5946 03 Feb 12 nicklas 123             image="shared.png" 
5937 27 Jan 12 nicklas 124             visible="<%=tag.isShared()%>"
5937 27 Jan 12 nicklas 125             tooltip="This item is shared to other users, groups and/or projects"
5937 27 Jan 12 nicklas 126           />
5937 27 Jan 12 nicklas 127           <base:icon 
6261 27 Mar 13 nicklas 128             id="btnDeletePermanently"
5946 03 Feb 12 nicklas 129             image="deleted.png"
5937 27 Jan 12 nicklas 130             tooltip="This item has been flagged for deletion. Click to delete it now."
5937 27 Jan 12 nicklas 131             enabled="<%=deletePermanentlyPermission %>"
5937 27 Jan 12 nicklas 132             visible="<%=isRemoved%>" 
5937 27 Jan 12 nicklas 133           />
6261 27 Mar 13 nicklas 134           <base:icon 
6261 27 Mar 13 nicklas 135             id="btnUsingItems"
6261 27 Mar 13 nicklas 136             image="used.png" 
5937 27 Jan 12 nicklas 137             tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one"
5937 27 Jan 12 nicklas 138             visible="<%=isRemoved && isUsed%>" />
5935 26 Jan 12 nicklas 139         </th>
5935 26 Jan 12 nicklas 140         <td style="padding: 0px;">
6605 18 Nov 14 nicklas 141           <tbl:toolbar subclass="bottomborder bg-filled-50">
5935 26 Jan 12 nicklas 142             <tbl:button 
6261 27 Mar 13 nicklas 143               id="btnEdit"
5942 01 Feb 12 nicklas 144               disabled="<%=!writePermission%>" 
5945 02 Feb 12 nicklas 145               image="edit.png" 
5935 26 Jan 12 nicklas 146               title="Edit&hellip;" 
5935 26 Jan 12 nicklas 147               tooltip="<%=writePermission ? "Edit this tag" : "You do not have permission to edit this tag"%>" 
5935 26 Jan 12 nicklas 148             />
5935 26 Jan 12 nicklas 149             <tbl:button 
6261 27 Mar 13 nicklas 150               id="btnDelete"
5942 01 Feb 12 nicklas 151               disabled="<%=!deletePermission%>" 
5946 03 Feb 12 nicklas 152               image="delete.png" 
5935 26 Jan 12 nicklas 153               title="Delete"
5935 26 Jan 12 nicklas 154               visible="<%=!tag.isRemoved()%>"
5935 26 Jan 12 nicklas 155               tooltip="<%=deletePermission ? "Delete this tag" : "You do not have permission to delete this tag"%>" 
5935 26 Jan 12 nicklas 156             />
5935 26 Jan 12 nicklas 157             <tbl:button 
6261 27 Mar 13 nicklas 158               id="btnRestore"
5942 01 Feb 12 nicklas 159               disabled="<%=!writePermission%>" 
5946 03 Feb 12 nicklas 160               image="restore.png" 
5935 26 Jan 12 nicklas 161               title="Restore"
5935 26 Jan 12 nicklas 162               visible="<%=tag.isRemoved()%>"
5935 26 Jan 12 nicklas 163               tooltip="<%=writePermission ? "Restore this tag" : "You do not have permission to restore this tag"%>" 
5935 26 Jan 12 nicklas 164             />
5935 26 Jan 12 nicklas 165             <tbl:button 
6261 27 Mar 13 nicklas 166               id="btnShare"
5942 01 Feb 12 nicklas 167               disabled="<%=!sharePermission%>"
5945 02 Feb 12 nicklas 168               image="share.png"
5935 26 Jan 12 nicklas 169               title="Share&hellip;" 
5935 26 Jan 12 nicklas 170               tooltip="<%=sharePermission ? "Share this tag to other user, groups and projects" : "You do not have permission to share this tag"%>"
5935 26 Jan 12 nicklas 171             />
5935 26 Jan 12 nicklas 172             <tbl:button 
6261 27 Mar 13 nicklas 173               id="btnSetOwner"
5942 01 Feb 12 nicklas 174               disabled="<%=!setOwnerPermission%>"
5935 26 Jan 12 nicklas 175               image="take_ownership.png"
5935 26 Jan 12 nicklas 176               title="Set owner&hellip;"
5935 26 Jan 12 nicklas 177               tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
5935 26 Jan 12 nicklas 178             />
5935 26 Jan 12 nicklas 179             <tbl:button 
6261 27 Mar 13 nicklas 180               id="btnImport"
5946 03 Feb 12 nicklas 181               image="import.png" 
6261 27 Mar 13 nicklas 182               data-plugin-type="IMPORT"  
5935 26 Jan 12 nicklas 183               title="Import&hellip;" 
5935 26 Jan 12 nicklas 184               tooltip="Import data" 
5935 26 Jan 12 nicklas 185               visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
5935 26 Jan 12 nicklas 186             />
5935 26 Jan 12 nicklas 187             <tbl:button 
6261 27 Mar 13 nicklas 188               id="btnExport"
6261 27 Mar 13 nicklas 189               image="export.png"
6261 27 Mar 13 nicklas 190               data-plugin-type="EXPORT" 
5935 26 Jan 12 nicklas 191               title="Export&hellip;" 
5935 26 Jan 12 nicklas 192               tooltip="Export data" 
5935 26 Jan 12 nicklas 193               visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
5935 26 Jan 12 nicklas 194             />
5935 26 Jan 12 nicklas 195             <tbl:button 
6261 27 Mar 13 nicklas 196               id="btnRunPlugin"
6261 27 Mar 13 nicklas 197               image="runplugin.png"  
6261 27 Mar 13 nicklas 198               data-plugin-type="OTHER" 
5935 26 Jan 12 nicklas 199               title="Run plugin&hellip;" 
5935 26 Jan 12 nicklas 200               tooltip="Run a plugin" 
5935 26 Jan 12 nicklas 201               visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
5935 26 Jan 12 nicklas 202             />
5935 26 Jan 12 nicklas 203             <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
7604 25 Feb 19 nicklas 204               wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/>
5935 26 Jan 12 nicklas 205             <tbl:button
5935 26 Jan 12 nicklas 206               image="help.png"
6261 27 Mar 13 nicklas 207               subclass="auto-init"
6261 27 Mar 13 nicklas 208               data-auto-init="help"
6261 27 Mar 13 nicklas 209               data-help-id="tag.view.properties"
5935 26 Jan 12 nicklas 210               title="Help&hellip;"
5935 26 Jan 12 nicklas 211               tooltip="Get help about this page"
5935 26 Jan 12 nicklas 212             />  
5935 26 Jan 12 nicklas 213             </tbl:toolbar>
5935 26 Jan 12 nicklas 214           </td>
5935 26 Jan 12 nicklas 215         </tr>
5935 26 Jan 12 nicklas 216         <tr>
5935 26 Jan 12 nicklas 217           <th>Name</th>
5935 26 Jan 12 nicklas 218           <td><%=HTML.encodeTags(tag.getName())%></td>
5935 26 Jan 12 nicklas 219         </tr>
5935 26 Jan 12 nicklas 220         <tr>
5935 26 Jan 12 nicklas 221           <th>Type</th>
5935 26 Jan 12 nicklas 222           <td><base:propertyvalue item="<%=tag%>" property="itemSubtype" /></td>
5935 26 Jan 12 nicklas 223         </tr>
5935 26 Jan 12 nicklas 224         <tr>
5935 26 Jan 12 nicklas 225           <th>Registered</th>
5935 26 Jan 12 nicklas 226           <td><%=dateFormatter.format(tag.getEntryDate())%></td>
5935 26 Jan 12 nicklas 227         </tr>
5935 26 Jan 12 nicklas 228         <tr>
5935 26 Jan 12 nicklas 229           <th>Owner</th>
5935 26 Jan 12 nicklas 230           <td><base:propertyvalue item="<%=tag%>" property="owner"/></td>
5935 26 Jan 12 nicklas 231         </tr>
5935 26 Jan 12 nicklas 232         <tr>
5937 27 Jan 12 nicklas 233           <th>Permissions</th>
5937 27 Jan 12 nicklas 234           <td><%=PermissionUtil.getFullPermissionNames(tag)%></td>
5937 27 Jan 12 nicklas 235         </tr>
5937 27 Jan 12 nicklas 236         <tr>
5935 26 Jan 12 nicklas 237           <th>Description</th>
5935 26 Jan 12 nicklas 238           <td><%=HTML.niceFormat(tag.getDescription())%></td>
5935 26 Jan 12 nicklas 239         </tr>
1864 30 Jan 06 nicklas 240       </table>
5935 26 Jan 12 nicklas 241       </div>
5496 17 Nov 10 nicklas 242       <jsp:include page="../../common/anytoany/list_anytoany.jsp">
5496 17 Nov 10 nicklas 243         <jsp:param name="ID" value="<%=ID%>" />
5496 17 Nov 10 nicklas 244         <jsp:param name="item_type" value="<%=itemType.name()%>" />
5496 17 Nov 10 nicklas 245         <jsp:param name="item_id" value="<%=itemId%>" />
5632 17 May 11 nicklas 246         <jsp:param name="title" value="Other items related to this tag" />
5496 17 Nov 10 nicklas 247       </jsp:include>
5935 26 Jan 12 nicklas 248       <jsp:include page="../../common/share/list_share.jsp">
5935 26 Jan 12 nicklas 249         <jsp:param name="ID" value="<%=ID%>" />
5935 26 Jan 12 nicklas 250         <jsp:param name="item_type" value="<%=itemType.name()%>" />
5935 26 Jan 12 nicklas 251         <jsp:param name="item_id" value="<%=itemId%>" />
5935 26 Jan 12 nicklas 252         <jsp:param name="title" value="Shared to" />
5935 26 Jan 12 nicklas 253       </jsp:include>
2466 06 Jul 06 martin 254     </t:tab>
6335 21 Oct 13 olle 255     <t:tab id="annotations" title="Annotations" 
6335 21 Oct 13 olle 256       tooltip="View annotation values" clazz="white">
6335 21 Oct 13 olle 257       <jsp:include page="../../common/annotations/list_frameset.jsp">
6335 21 Oct 13 olle 258         <jsp:param name="item_type" value="<%=itemType.name()%>" />
6335 21 Oct 13 olle 259         <jsp:param name="item_id" value="<%=itemId%>" />
6335 21 Oct 13 olle 260         <jsp:param name="ID" value="<%=ID%>" />
6335 21 Oct 13 olle 261       </jsp:include>
6335 21 Oct 13 olle 262     </t:tab>
7166 07 Jun 16 nicklas 263     <t:tab id="history" title="History"
7166 07 Jun 16 nicklas 264       tooltip="Displays a log with the history of this item"
6362 28 Nov 13 olle 265       visible="<%=ChangeHistoryUtil.showChangeHistoryTab(sc)%>">
6362 28 Nov 13 olle 266       <jsp:include page="../../common/history/frameset.jsp">
6362 28 Nov 13 olle 267         <jsp:param name="item_type" value="<%=itemType.name()%>" />
6362 28 Nov 13 olle 268         <jsp:param name="item_id" value="<%=itemId%>" />
6362 28 Nov 13 olle 269         <jsp:param name="ID" value="<%=ID%>" />
6362 28 Nov 13 olle 270       </jsp:include>
6362 28 Nov 13 olle 271     </t:tab>
2466 06 Jul 06 martin 272     </t:tabcontrol>
1864 30 Jan 06 nicklas 273
1864 30 Jan 06 nicklas 274   </base:body>
1864 30 Jan 06 nicklas 275   </base:page>
1864 30 Jan 06 nicklas 276   <%
1864 30 Jan 06 nicklas 277 }
1864 30 Jan 06 nicklas 278 finally
1864 30 Jan 06 nicklas 279 {
1864 30 Jan 06 nicklas 280   if (dc != null) dc.close();
1864 30 Jan 06 nicklas 281 }
1864 30 Jan 06 nicklas 282
1864 30 Jan 06 nicklas 283 %>