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

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

References #721: Changed systemId to externalId in JSP as well

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 8.5 KB
Line 
1<%-- $Id: view_platform.jsp 3798 2007-09-28 06:45:09Z 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    </script>
104  </base:head>
105  <base:body>
106    <p>
107    <p:path>
108      <p:pathelement title="Platforms" href="<%="index.jsp?ID="+ID%>" />
109      <p:pathelement title="<%=HTML.encodeTags(platform.getName())%>" />
110    </p:path>
111   
112    <t:tabcontrol id="main" active="properties">
113    <t:tab id="properties" title="Properties">
114   
115    <tbl:toolbar
116      >
117      <tbl:button 
118        disabled="<%=writePermission ? false : true%>" 
119        image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" 
120        onclick="editItem()" 
121        title="Edit&hellip;" 
122        tooltip="<%=writePermission ? "Edit this platform" : "You do not have permission to edit this platform"%>" 
123      />
124      <tbl:button 
125        disabled="<%=deletePermission ? false : true%>" 
126        image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" 
127        onclick="deleteItem()" 
128        title="Delete"
129        visible="<%=!platform.isRemoved()%>"
130        tooltip="<%=deletePermission ? "Delete this platform" : "You do not have permission to delete this platform"%>" 
131      />
132      <tbl:button 
133        disabled="<%=writePermission ? false : true%>" 
134        image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" 
135        onclick="restoreItem()" 
136        title="Restore"
137        visible="<%=platform.isRemoved()%>"
138        tooltip="<%=writePermission ? "Restore this platform" : "You do not have permission to restore this platform"%>" 
139      />
140      <tbl:button
141        image="add.png"
142        onclick="newVariant()"
143        title="New variant&hellip;"
144        tooltip="Create a new variant of this platform"
145        visible="<%=sc.hasPermission(Permission.CREATE, Item.PLATFORMVARIANT)%>"
146      />
147      <tbl:button 
148        image="import.gif" 
149        onclick="runPlugin('ImportItem')" 
150        title="Import&hellip;" 
151        tooltip="Import data" 
152        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
153      />
154      <tbl:button 
155        image="export.gif" 
156        onclick="runPlugin('ExportItem')" 
157        title="Export&hellip;" 
158        tooltip="Export data" 
159        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
160      />
161      <tbl:button 
162        image="runplugin.gif" 
163        onclick="runPlugin('RunPlugin')" 
164        title="Run plugin&hellip;" 
165        tooltip="Run a plugin" 
166        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
167      />
168      <tbl:button
169        image="help.gif"
170        onclick="<%="Main.openHelp('" + ID +"', 'platform.view.properties')"%>"
171        title="Help&hellip;"
172        tooltip="Get help about this page"
173      />
174      </tbl:toolbar>
175    <div class="boxedbottom">
176      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(platform)%></i></div>
177      <%
178      if (platform.isRemoved())
179      {
180        %>
181        <div class="itemstatus">
182          <base:icon image="deleted.gif" 
183            visible="<%=platform.isRemoved()%>"> This item has been flagged for deletion<br></base:icon>
184        </div>
185        <%
186      }
187      %>
188      <table class="form" cellspacing=0>
189      <tr>
190        <td class="prompt">Name</td>
191        <td><%=HTML.encodeTags(platform.getName())%></td>
192      </tr>
193      <tr>
194        <td class="prompt">External ID</td>
195        <td><%=HTML.encodeTags(platform.getExternalId())%></td>
196      </tr>
197      <tr>
198        <td class="prompt">File-only</td>
199        <td><%=platform.isFileOnly() ? "yes" : "no"%></td>
200      </tr>
201      <%
202      RawDataType rdt = platform.getRawDataType();
203      if (!platform.isFileOnly())
204      {
205        %>
206        <tr>
207          <td class="prompt">Raw data type</td>
208          <td><%=rdt == null ? "<i>- any -</i>" : rdt.getName()%></td>
209        </tr>
210        <%
211      }
212      else
213      {
214        %>
215        <tr>
216          <td class="prompt">Channels</td>
217          <td><%=rdt.getChannels()%></td>
218        </tr>
219        <%
220      }
221      %>
222      <tr valign="baseline">
223        <td class="prompt">Description</td>
224        <td><%=HTML.niceFormat(platform.getDescription())%></td>
225      </tr>
226      </table>
227     
228    </div>
229      </t:tab>
230      </t:tabcontrol>
231     
232      <%
233      ItemQuery<PlatformVariant> variantQuery = platform.getVariants();
234      variantQuery.order(Orders.asc(Hql.property("name")));
235      ItemResultList<PlatformVariant> variants = variantQuery.list(dc);
236      if (variants.size() == 0)
237      {
238        %>
239        <h4>Variants</h4>
240        No variants of this platform exists
241        (or, you don't have permission to view them).
242        <%
243      }
244      else
245      {
246        %>
247        <h4 class="docked">Variants</h4>
248        <tbl:table
249          id="variants"
250          clazz="itemlist"
251          columns="all"
252          >
253        <tbl:columndef 
254          id="name"
255          title="Name"
256        />
257        <tbl:columndef 
258          id="description"
259          title="Description"
260        />
261        <tbl:data>
262          <tbl:columns>
263          </tbl:columns>
264          <tbl:rows>
265          <%
266          for (PlatformVariant item : variants)
267          {
268            %>
269            <tbl:row>
270              <tbl:cell column="name"><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell>
271              <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
272            </tbl:row>
273            <%
274          }
275          %>
276          </tbl:rows>
277        </tbl:data>
278        </tbl:table>
279        <%
280      }
281      %>
282  </base:body>
283  </base:page>
284  <%
285}
286finally
287{
288  if (dc != null) dc.close();
289}
290
291%>
Note: See TracBrowser for help on using the repository browser.