source: trunk/www/views/experiments/bioassays/view_bioassay.jsp @ 3679

Last change on this file since 3679 was 3679, checked in by Jari Häkkinen, 15 years ago

Changing the pesky "a (ä) character to a.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 8.0 KB
Line 
1<%-- $Id: view_bioassay.jsp 3679 2007-08-17 07:18:29Z jari $
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
25  @author Nicklas
26  @version 2.0
27--%>
28<%@ page session="false"
29  import="net.sf.basedb.core.SessionControl"
30  import="net.sf.basedb.core.DbControl"
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.Experiment"
35  import="net.sf.basedb.core.BioAssaySet"
36  import="net.sf.basedb.core.BioAssay"
37  import="net.sf.basedb.core.RawBioAssay"
38  import="net.sf.basedb.core.ItemQuery"
39  import="net.sf.basedb.core.ItemResultList"
40  import="net.sf.basedb.core.Include"
41  import="net.sf.basedb.core.BaseException"
42  import="net.sf.basedb.core.PluginDefinition"
43  import="net.sf.basedb.core.plugin.GuiContext"
44  import="net.sf.basedb.core.plugin.Plugin"
45  import="net.sf.basedb.core.query.Orders"
46  import="net.sf.basedb.core.query.Hql"
47  import="net.sf.basedb.clients.web.Base"
48  import="net.sf.basedb.clients.web.PermissionUtil"
49  import="net.sf.basedb.clients.web.util.HTML"
50  import="net.sf.basedb.util.Values"
51  import="java.util.Map"
52%>
53<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
54<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
55<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
56<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
57<%!
58  private static final Item itemType = Item.BIOASSAY;
59  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
60%>
61<%
62final Item itemType = Item.BIOASSAY;
63final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
64final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
65final int itemId = cc.getId();
66final String ID = sc.getId();
67final float scale = Base.getScale(sc);
68final String tabId = Values.getString(request.getParameter("tab"), "properties");
69final DbControl dc = sc.newDbControl();
70try
71{
72  BioAssay bioAssay = BioAssay.getById(dc, itemId);
73  BioAssaySet bioAssaySet = bioAssay.getBioAssaySet();
74  Experiment experiment = bioAssay.getExperiment();
75  String title = null;
76  final boolean writePermission = bioAssay.hasPermission(Permission.WRITE);
77  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
78  %>
79
80  <base:page title="<%=title%>">
81  <base:head scripts="table.js,tabcontrol.js" styles="table.css,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 runPlugin(cmd)
88    {
89      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
90    }
91    function switchTab(tabControlId, tabId)
92    {
93      if (tabId == 'spotdata')
94      {
95        location.href = "../spotdata/index.jsp?ID=<%=ID%>&bioassay_id=<%=itemId%>";
96      }
97      else
98      {
99        TabControl.setActiveTab(tabControlId, tabId);
100      }
101    }
102    function openPlotTool()
103    {
104      Main.openPopup('../plotter/index.jsp?ID=<%=ID%>&bioassay_id=<%=itemId%>', 'Plotter', 1000, 700);
105    }
106    </script>
107  </base:head>
108  <base:body>
109    <p>
110    <p:path>
111      <p:pathelement title="Experiments" href="<%="../index.jsp?ID="+ID%>" />
112      <p:pathelement title="<%=HTML.encodeTags(experiment.getName())%>" 
113        href="<%="../bioassaysets/index.jsp?ID="+ID+"&experiment_id="+experiment.getId()%>" />
114      <p:pathelement title="<%=HTML.encodeTags(bioAssaySet.getName())%>" 
115        href="<%="index.jsp?ID="+ID+"&bioassayset_id="+bioAssaySet.getId()%>" />
116      <p:pathelement title="<%=HTML.encodeTags(bioAssay.getName())%>" />
117    </p:path>
118
119    <t:tabcontrol id="main" active="<%=tabId%>" switch="switchTab">
120    <t:tab id="properties" title="Properties">
121    <tbl:toolbar
122      >
123      <tbl:button 
124        disabled="<%=writePermission ? false : true%>" 
125        image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" 
126        onclick="editItem()" 
127        title="Edit&hellip;" 
128        tooltip="<%=writePermission ? "Edit this bioassay" : "You do not have permission to edit this bioassay"%>" 
129      />
130      <tbl:button 
131        image="import.gif" 
132        onclick="runPlugin('ImportItem')" 
133        title="Import&hellip;" 
134        tooltip="Import data" 
135        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
136      />
137      <tbl:button 
138        image="export.gif" 
139        onclick="runPlugin('ExportItem')" 
140        title="Export&hellip;" 
141        tooltip="Export data" 
142        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
143      />
144      <tbl:button 
145        image="runplugin.gif" 
146        onclick="runPlugin('RunPlugin')" 
147        title="Run plugin&hellip;" 
148        tooltip="Run a plugin" 
149        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
150      />
151      <tbl:button
152        image="plotter.gif"
153        onclick="openPlotTool()"
154        title="Plot tool&hellip;"
155        tooltip="A simple tool for generating plots"
156      />
157      <tbl:button
158        image="help.gif"
159        onclick="<%="Main.openHelp('" + ID +"', 'bioassay.view.properties')"%>"
160        title="Help&hellip;"
161        tooltip="Get help about this page"
162      />
163      </tbl:toolbar>
164     
165    <div class="boxedbottom">
166      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(bioAssay)%></i></div>
167      <table class="form" cellspacing=0>
168      <tr>
169        <td class="prompt">Name</td>
170        <td><%=HTML.encodeTags(bioAssay.getName())%></td>
171      </tr>
172      <tr>
173        <td class="prompt">Spots</td>
174        <td><%=bioAssay.getNumSpots()%></td>
175      </tr>
176      <tr valign=top>
177        <td class="prompt">Description</td>
178        <td><%=HTML.encodeTags(bioAssay.getDescription())%></td>
179      </tr>
180      </table>
181   
182      <%
183      ItemQuery<RawBioAssay> rawQuery = bioAssay.getRawBioAssays();
184      rawQuery.include(Include.MINE, Include.SHARED, Include.OTHERS, Include.IN_PROJECT);
185      rawQuery.order(Orders.asc(Hql.property("name")));
186      ItemResultList<RawBioAssay> rawBioAssays = rawQuery.list(dc);
187      if (rawBioAssays.size() == 0)
188      {
189        %>
190        <h4>Raw bioassays</h4>
191        No raw bioassays are linked to this bioassay
192        (or, you don't have permission to view them).
193        <%
194      }
195      else
196      {
197        %>
198        <h4 class="docked">Raw bioassays</h4>
199        <tbl:table
200          id="rawBioAssays"
201          clazz="itemlist"
202          columns="all"
203          >
204        <tbl:columndef 
205          id="name"
206          title="Name"
207        />
208        <tbl:columndef
209          id="spots"
210          title="Spots"
211        />
212        <tbl:columndef 
213          id="description"
214          title="Description"
215        />
216        <tbl:data>
217          <tbl:columns>
218          </tbl:columns>
219          <tbl:rows>
220          <%
221          for (RawBioAssay item : rawBioAssays)
222          {
223            %>
224            <tbl:row>
225              <tbl:cell column="name"><%=Base.getLinkedName(ID, item, false, true)%></tbl:cell>
226              <tbl:cell column="spots"><%=item.getSpots()%></tbl:cell>
227              <tbl:cell column="description"><%=HTML.encodeTags(item.getDescription())%></tbl:cell>
228            </tbl:row>
229            <%
230          }
231          %>
232          </tbl:rows>
233        </tbl:data>
234        </tbl:table>
235        <%
236      }
237      %>
238    </div>
239    </t:tab>
240   
241    <t:tab id="annotations" title="Annotations" 
242      tooltip="View annotation values">
243      <div class="boxed">
244      <jsp:include page="../../../common/annotations/list_annotations.jsp">
245        <jsp:param name="item_type" value="<%=itemType.name()%>" />
246        <jsp:param name="item_id" value="<%=itemId%>" />
247        <jsp:param name="ID" value="<%=ID%>" />
248      </jsp:include>
249      </div>
250    </t:tab>
251
252    <t:tab id="spotdata" title="Spot data" />
253   
254    </t:tabcontrol>
255
256
257  </base:body>
258  </base:page>
259  <%
260}
261finally
262{
263  if (dc != null) dc.close();
264}
265%>
Note: See TracBrowser for help on using the repository browser.