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

Last change on this file since 2446 was 2446, checked in by Nicklas Nordborg, 16 years ago

References #270: Make array lims web gui more user friendly

Updated pages for Plate geometries, Plate type, Plate event types, Plates, Plate events and
wells.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 6.9 KB
Line 
1<%-- $Id: view_event.jsp 2446 2006-06-29 09:43:30Z nicklas $
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  Protocol currentProtocol = null;
85  boolean readCurrentProtocol = true;
86  try
87  {
88    currentProtocol = event.getProtocol();
89  }
90  catch (PermissionDeniedException ex)
91  {
92    readCurrentProtocol = false;
93  }
94 
95  final boolean writePermission = event.hasPermission(Permission.WRITE);
96  final boolean deletePermission = event.hasPermission(Permission.DELETE);
97  %>
98
99  <base:page title="<%=title%>">
100  <base:head scripts="table.js,tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
101    <script language="JavaScript">
102    function editItem()
103    {
104      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
105    }
106    function deleteItem()
107    {
108      if (confirm('This can\'t be undone. Continue?'))
109      {
110        location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&plate_id=<%=plateId%>&item_id=<%=itemId%>');
111      }
112    }
113    function runPlugin(cmd)
114    {
115      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&plate_id=<%=plateId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
116    }
117    </script>
118  </base:head>
119  <base:body>
120    <p>
121    <p:path>
122      <p:pathelement title="Plates" href="<%="../index.jsp?ID="+ID%>" />
123      <p:pathelement 
124        title="<%=HTML.encodeTags(plate.getName())%>" 
125        href="<%="index.jsp?ID="+ID+"&plate_id="+plateId%>" />
126      <p:pathelement title="<%="Event: "+Base.getEncodedName(currentEventType, !readCurrentEventType)%>" />
127    </p:path>
128   
129    <t:tabcontrol id="main" active="properties" switch="switchTab">
130    <t:tab id="properties" title="Properties">
131
132    <tbl:toolbar
133      >
134      <tbl:button 
135        disabled="<%=writePermission ? false : true%>" 
136        image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" 
137        onclick="editItem()" 
138        title="Edit&hellip;" 
139        tooltip="<%=writePermission ? "Edit this event" : "You do not have permission to edit this event"%>" 
140      />
141      <tbl:button 
142        disabled="<%=deletePermission ? false : true%>" 
143        image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" 
144        onclick="deleteItem()" 
145        title="Delete"
146        tooltip="<%=deletePermission ? "Delete this event" : "You do not have permission to event this event"%>" 
147      />
148      <tbl:button 
149        image="import.gif" 
150        onclick="runPlugin('ImportItem')" 
151        title="Import&hellip;" 
152        tooltip="Import data" 
153        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
154      />
155      <tbl:button 
156        image="export.gif" 
157        onclick="runPlugin('ExportItem')" 
158        title="Export&hellip;" 
159        tooltip="Export data" 
160        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
161      />
162      <tbl:button 
163        image="runplugin.gif" 
164        onclick="runPlugin('RunPlugin')" 
165        title="Run plugin&hellip;" 
166        tooltip="Run a plugin" 
167        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
168      />
169      <tbl:button
170        image="help.gif"
171        onclick="<%="Main.openHelp('" + ID +"', 'plateevent.view.properties')"%>"
172        title="Help&hellip;"
173        tooltip="Get help about this page"
174      />
175      </tbl:toolbar>
176     
177    <div class="boxedbottom">
178      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(event)%></i></div>
179      <table class="form" cellspacing=0>
180      <tr>
181        <td class="prompt">User</td>
182        <td><base:propertyvalue item="<%=event%>" property="user" /></td>
183      </tr>
184      <tr>
185        <td class="prompt">Event date</td>
186        <td><%=Values.formatDate(event.getEventDate())%></td>
187      </tr>
188      <tr>
189        <td class="prompt">Registration date</td>
190        <td><%=Values.formatDate(event.getEntryDate())%></td>
191      </tr>
192      <tr>
193        <td class="prompt">Event type</td>
194        <td>
195          <%=currentEventType != null ? currentEventType.getOrdinal() + ". " : ""%>
196          <%=Base.getLinkedName(ID, currentEventType, !readCurrentEventType, true)%>
197        </td>
198      </tr>
199      <tr>
200        <td class="prompt">Protocol</td>
201        <td><base:propertyvalue item="<%=event%>" property="protocol" /></td>
202      </tr>
203      <tr>
204        <td class="prompt">Comment</td>
205        <td><%=HTML.niceFormat(event.getComment())%></td>
206      </tr>
207      </table>
208    </div>
209      </t:tab>
210      </t:tabcontrol>
211
212  </base:body>
213  </base:page>
214  <%
215}
216finally
217{
218  if (dc != null) dc.close();
219}
220
221%>
Note: See TracBrowser for help on using the repository browser.