source: branches/filedb/www/admin/platforms/view_platform.jsp @ 3799

Last change on this file since 3799 was 3799, checked in by Nicklas Nordborg, 15 years ago

References #721: Added platform variants to web gui.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 7.9 KB
Line 
1<%-- $Id: view_platform.jsp 3799 2007-09-28 07:50:15Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Hakkinen, Nicklas Nordborg, Martin Svensson
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 session="false"
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.Platform"
35  import="net.sf.basedb.core.PlatformVariant"
36  import="net.sf.basedb.core.RawDataType"
37  import="net.sf.basedb.core.ItemQuery"
38  import="net.sf.basedb.core.ItemResultList"
39  import="net.sf.basedb.core.PermissionDeniedException"
40  import="net.sf.basedb.core.PluginDefinition"
41  import="net.sf.basedb.core.plugin.GuiContext"
42  import="net.sf.basedb.core.plugin.Plugin"
43  import="net.sf.basedb.core.query.Orders"
44  import="net.sf.basedb.core.query.Hql"
45  import="net.sf.basedb.clients.web.Base"
46  import="net.sf.basedb.clients.web.PermissionUtil"
47  import="net.sf.basedb.clients.web.util.HTML"
48  import="net.sf.basedb.util.formatter.Formatter"
49  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
50  import="net.sf.basedb.util.Values"
51  import="java.util.Map"
52  import="java.util.Date"
53%>
54<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
55<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
56<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
57<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
58<%!
59  private static final Item itemType = Item.PLATFORM;
60  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
61%>
62<%
63final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
64final String ID = sc.getId();
65final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
66final int itemId = cc.getId();
67final float scale = Base.getScale(sc);
68final DbControl dc = sc.newDbControl();
69try
70{
71  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
72
73  String title = null;
74  Platform platform = Platform.getById(dc, itemId);
75 
76  final boolean writePermission = platform.hasPermission(Permission.WRITE);
77  final boolean deletePermission = platform.hasPermission(Permission.DELETE);
78  %>
79
80  <base:page title="<%=title%>">
81  <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css">
82    <script language="JavaScript">
83    function editItem()
84    {
85      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
86    }
87    function deleteItem()
88    {
89      location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');
90    }
91    function restoreItem()
92    {
93      location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');
94    }
95    function runPlugin(cmd)
96    {
97      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
98    }
99    function newVariant()
100    {
101      Main.viewOrEditItem('<%=ID%>', 'PLATFORMVARIANT', 0, true, '&platform_id=<%=itemId%>');
102    }
103    function viewVariants()
104    {
105      location.href = 'variants/index.jsp?ID=<%=ID%>&cmd=List&platform_id=<%=itemId%>';
106    }
107    function switchTab(tabControlId, tabId)
108    {
109      if (tabId == 'variants')
110      {
111        viewVariants();
112      }
113      else
114      {
115        TabControl.setActiveTab(tabControlId, tabId);
116      }
117    }
118    </script>
119  </base:head>
120  <base:body>
121    <p>
122    <p:path>
123      <p:pathelement title="Platforms" href="<%="index.jsp?ID="+ID%>" />
124      <p:pathelement title="<%=HTML.encodeTags(platform.getName())%>" />
125    </p:path>
126   
127    <t:tabcontrol id="main" active="properties" switch="switchTab">
128    <t:tab id="properties" title="Properties">
129   
130    <tbl:toolbar
131      >
132      <tbl:button 
133        disabled="<%=writePermission ? false : true%>" 
134        image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" 
135        onclick="editItem()" 
136        title="Edit&hellip;" 
137        tooltip="<%=writePermission ? "Edit this platform" : "You do not have permission to edit this platform"%>" 
138      />
139      <tbl:button 
140        disabled="<%=deletePermission ? false : true%>" 
141        image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" 
142        onclick="deleteItem()" 
143        title="Delete"
144        visible="<%=!platform.isRemoved()%>"
145        tooltip="<%=deletePermission ? "Delete this platform" : "You do not have permission to delete this platform"%>" 
146      />
147      <tbl:button 
148        disabled="<%=writePermission ? false : true%>" 
149        image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" 
150        onclick="restoreItem()" 
151        title="Restore"
152        visible="<%=platform.isRemoved()%>"
153        tooltip="<%=writePermission ? "Restore this platform" : "You do not have permission to restore this platform"%>" 
154      />
155      <tbl:button
156        image="add.png"
157        onclick="newVariant()"
158        title="New variant&hellip;"
159        tooltip="Create a new variant of this platform"
160        visible="<%=sc.hasPermission(Permission.CREATE, Item.PLATFORMVARIANT)%>"
161      />
162      <tbl:button 
163        image="import.gif" 
164        onclick="runPlugin('ImportItem')" 
165        title="Import&hellip;" 
166        tooltip="Import data" 
167        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
168      />
169      <tbl:button 
170        image="export.gif" 
171        onclick="runPlugin('ExportItem')" 
172        title="Export&hellip;" 
173        tooltip="Export data" 
174        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
175      />
176      <tbl:button 
177        image="runplugin.gif" 
178        onclick="runPlugin('RunPlugin')" 
179        title="Run plugin&hellip;" 
180        tooltip="Run a plugin" 
181        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
182      />
183      <tbl:button
184        image="help.gif"
185        onclick="<%="Main.openHelp('" + ID +"', 'platform.view.properties')"%>"
186        title="Help&hellip;"
187        tooltip="Get help about this page"
188      />
189      </tbl:toolbar>
190    <div class="boxedbottom">
191      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(platform)%></i></div>
192      <%
193      if (platform.isRemoved())
194      {
195        %>
196        <div class="itemstatus">
197          <base:icon image="deleted.gif" 
198            visible="<%=platform.isRemoved()%>"> This item has been flagged for deletion<br></base:icon>
199        </div>
200        <%
201      }
202      %>
203      <table class="form" cellspacing=0>
204      <tr>
205        <td class="prompt">Name</td>
206        <td><%=HTML.encodeTags(platform.getName())%></td>
207      </tr>
208      <tr>
209        <td class="prompt">External ID</td>
210        <td><%=HTML.encodeTags(platform.getExternalId())%></td>
211      </tr>
212      <tr>
213        <td class="prompt">File-only</td>
214        <td><%=platform.isFileOnly() ? "yes" : "no"%></td>
215      </tr>
216      <%
217      RawDataType rdt = platform.getRawDataType();
218      if (!platform.isFileOnly())
219      {
220        %>
221        <tr>
222          <td class="prompt">Raw data type</td>
223          <td><%=rdt == null ? "<i>- any -</i>" : rdt.getName()%></td>
224        </tr>
225        <%
226      }
227      else
228      {
229        %>
230        <tr>
231          <td class="prompt">Channels</td>
232          <td><%=rdt.getChannels()%></td>
233        </tr>
234        <%
235      }
236      %>
237      <tr valign="baseline">
238        <td class="prompt">Description</td>
239        <td><%=HTML.niceFormat(platform.getDescription())%></td>
240      </tr>
241      </table>
242     
243    </div>
244      </t:tab>
245      <t:tab id="variants" title="Variants" 
246        tooltip="View and manage variants of this platform" />
247      </t:tabcontrol>
248     
249
250  </base:body>
251  </base:page>
252  <%
253}
254finally
255{
256  if (dc != null) dc.close();
257}
258
259%>
Note: See TracBrowser for help on using the repository browser.