source: trunk/www/lims/plates/events/view_event.jsp @ 2486

Last change on this file since 2486 was 2486, checked in by Martin Svensson, 16 years ago

References #173. Possible to attach a hardware to a PlateEvent? in the GUI

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 6.8 KB
Line 
1<%-- $Id: view_event.jsp 2486 2006-08-03 15:20:10Z martin $
2  ------------------------------------------------------------------
3  Copyright (C) Authors contributing to this file.
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 2
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 this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA  02111-1307, USA.
22  ------------------------------------------------------------------
23
24  @author Nicklas
25  @version 2.0
26--%>
27<%@ page
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.SystemItems"
31  import="net.sf.basedb.core.Item"
32  import="net.sf.basedb.core.ItemContext"
33  import="net.sf.basedb.core.Permission"
34  import="net.sf.basedb.core.Plate"
35  import="net.sf.basedb.core.PlateEvent"
36  import="net.sf.basedb.core.PlateEventType"
37  import="net.sf.basedb.core.Protocol"
38  import="net.sf.basedb.core.PermissionDeniedException"
39  import="net.sf.basedb.core.PluginDefinition"
40  import="net.sf.basedb.core.plugin.GuiContext"
41  import="net.sf.basedb.core.plugin.Plugin"
42  import="net.sf.basedb.clients.web.Base"
43  import="net.sf.basedb.clients.web.PermissionUtil"
44  import="net.sf.basedb.clients.web.util.HTML"
45  import="net.sf.basedb.clients.web.util.Values"
46  import="java.util.Date"
47  import="java.util.Map"
48  import="java.util.Set"
49%>
50<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
51<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
52<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
53<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
54<%!
55  private static final Item itemType = Item.PLATEEVENT;
56  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
57%>
58<%
59final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
60final String ID = sc.getId();
61final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
62final int itemId = cc.getId();
63final float scale = Base.getScale(sc);
64final DbControl dc = sc.newDbControl();
65try
66{
67  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
68
69  String title = null;
70  final PlateEvent event = PlateEvent.getById(dc, itemId);
71  final Plate plate = event.getPlate();
72  final int plateId = plate.getId();
73
74  PlateEventType currentEventType = null;
75  boolean readCurrentEventType = true;
76  try
77  {
78    currentEventType = event.getPlateEventType();
79  }
80  catch (PermissionDeniedException ex)
81  {
82    readCurrentEventType = false;
83  }
84 
85  final boolean writePermission = event.hasPermission(Permission.WRITE);
86  final boolean deletePermission = event.hasPermission(Permission.DELETE);
87  %>
88
89  <base:page title="<%=title%>">
90  <base:head scripts="table.js,tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
91    <script language="JavaScript">
92    function editItem()
93    {
94      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
95    }
96    function deleteItem()
97    {
98      if (confirm('This can\'t be undone. Continue?'))
99      {
100        location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&plate_id=<%=plateId%>&item_id=<%=itemId%>');
101      }
102    }
103    function runPlugin(cmd)
104    {
105      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&plate_id=<%=plateId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
106    }
107    </script>
108  </base:head>
109  <base:body>
110    <p>
111    <p:path>
112      <p:pathelement title="Plates" href="<%="../index.jsp?ID="+ID%>" />
113      <p:pathelement 
114        title="<%=HTML.encodeTags(plate.getName())%>" 
115        href="<%="index.jsp?ID="+ID+"&plate_id="+plateId%>" />
116      <p:pathelement title="<%="Event: "+Base.getEncodedName(currentEventType, !readCurrentEventType)%>" />
117    </p:path>
118   
119    <t:tabcontrol id="main" active="properties" switch="switchTab">
120    <t:tab id="properties" title="Properties">
121
122    <tbl:toolbar
123      >
124      <tbl:button 
125        disabled="<%=writePermission ? false : true%>" 
126        image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" 
127        onclick="editItem()" 
128        title="Edit&hellip;" 
129        tooltip="<%=writePermission ? "Edit this event" : "You do not have permission to edit this event"%>" 
130      />
131      <tbl:button 
132        disabled="<%=deletePermission ? false : true%>" 
133        image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" 
134        onclick="deleteItem()" 
135        title="Delete"
136        tooltip="<%=deletePermission ? "Delete this event" : "You do not have permission to event this event"%>" 
137      />
138      <tbl:button 
139        image="import.gif" 
140        onclick="runPlugin('ImportItem')" 
141        title="Import&hellip;" 
142        tooltip="Import data" 
143        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
144      />
145      <tbl:button 
146        image="export.gif" 
147        onclick="runPlugin('ExportItem')" 
148        title="Export&hellip;" 
149        tooltip="Export data" 
150        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
151      />
152      <tbl:button 
153        image="runplugin.gif" 
154        onclick="runPlugin('RunPlugin')" 
155        title="Run plugin&hellip;" 
156        tooltip="Run a plugin" 
157        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
158      />
159      <tbl:button
160        image="help.gif"
161        onclick="<%="Main.openHelp('" + ID +"', 'plateevent.view.properties')"%>"
162        title="Help&hellip;"
163        tooltip="Get help about this page"
164      />
165      </tbl:toolbar>
166     
167    <div class="boxedbottom">
168      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(event)%></i></div>
169      <table class="form" cellspacing=0>
170      <tr>
171        <td class="prompt">User</td>
172        <td><base:propertyvalue item="<%=event%>" property="user" /></td>
173      </tr>
174      <tr>
175        <td class="prompt">Event date</td>
176        <td><%=Values.formatDate(event.getEventDate())%></td>
177      </tr>
178      <tr>
179        <td class="prompt">Registration date</td>
180        <td><%=Values.formatDate(event.getEntryDate())%></td>
181      </tr>
182      <tr>
183        <td class="prompt">Event type</td>
184        <td>
185          <%=currentEventType != null ? currentEventType.getOrdinal() + ". " : ""%>
186          <%=Base.getLinkedName(ID, currentEventType, !readCurrentEventType, true)%>
187        </td>
188      </tr>
189      <tr>
190        <td class="prompt">Protocol</td>
191        <td><base:propertyvalue item="<%=event%>" property="protocol" /></td>
192      </tr>
193      <tr>
194        <td class="prompt">Hardware</td>
195        <td><base:propertyvalue item="<%=event%>" property="hardware" /></td>
196      </tr>
197      <tr>
198        <td class="prompt">Comment</td>
199        <td><%=HTML.niceFormat(event.getComment())%></td>
200      </tr>
201      </table>
202    </div>
203      </t:tab>
204      </t:tabcontrol>
205
206  </base:body>
207  </base:page>
208  <%
209}
210finally
211{
212  if (dc != null) dc.close();
213}
214
215%>
Note: See TracBrowser for help on using the repository browser.