source: trunk/www/views/experiments/overview/overview.jsp @ 3033

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

References #262, #340: First prototype for experiment overview. Reads most of an
experiment. Limited validation. No presets. No detailed information about an error/warning.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 4.4 KB
Line 
1<%-- $Id: overview.jsp 3033 2006-12-15 14:30:37Z 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 session="false"
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.Item"
31  import="net.sf.basedb.core.Permission"
32  import="net.sf.basedb.core.ItemContext"
33  import="net.sf.basedb.core.Experiment"
34  import="net.sf.basedb.util.Values"
35  import="net.sf.basedb.clients.web.Base"
36  import="net.sf.basedb.clients.web.util.HTML"
37%>
38<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
39<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
40<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
41<%!
42  private static final Item itemType = Item.EXPERIMENT;
43%>
44<%
45final SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, itemType);
46final String ID = sc.getId();
47final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
48final int itemId = cc.getId();
49final DbControl dc = sc.newDbControl();
50try
51{
52  Experiment experiment = Experiment.getById(dc, itemId);
53  %>
54  <base:page title="">
55  <base:head scripts="tabcontrol.js" styles="headertabcontrol.css,path.css">
56    <script language="JavaScript">
57    var timer = 0;
58    var inCall = false;
59    function adjustIFrameSize()
60    {
61      if (inCall) return;
62      inCall = true;
63      var iframeElement = document.getElementById("idOverview");
64      // Find the top coordinate of the IFrame
65      var offsetTop = 10;
66      var offsetTrail = iframeElement;
67      while (offsetTrail)
68      {
69        offsetTop += offsetTrail.offsetTop;
70        offsetTrail = offsetTrail.offsetParent;
71      }
72 
73      // Find the browser window height
74      var windowHeight = Main.getWindowHeight();
75      iframeElement.height = windowHeight-offsetTop;
76 
77      // Adjust the height of the frames
78      var iframe = window.frames['overview'];
79      var tree = iframe.frames['tree'].document.getElementById('main');
80      if (tree) tree.style.height = (iframeElement.height-1)+'px';
81      var joust = iframe.frames['tree'].document.getElementById('joust');
82      if (joust) joust.style.height = (iframeElement.height-1-30)+'px';
83      var info = iframe.frames['info'].document.getElementById('main');
84      if (info) info.style.height = iframeElement.height+'px';
85      inCall = false;
86    }
87    function setTimer()
88    {
89      if (inCall) return;
90      if (timer) clearTimeout(timer);
91      timer = setTimeout('adjustIFrameSize()', 150);
92    }
93    function viewExperimentProperties()
94    {
95      location.href = '../index.jsp?ID=<%=ID%>&item_id=<%=itemId%>&cmd=ViewItem';
96    }
97    function viewBioAssaySets()
98    {
99      location.href = '../bioassaysets/index.jsp?ID=<%=ID%>&experiment_id=<%=itemId%>';
100    }
101    function switchTab(tabControlId, tabId)
102    {
103      if (tabId == 'properties')
104      {
105        viewExperimentProperties();
106      }
107      else if (tabId == 'bioassaysets')
108      {
109        viewBioAssaySets();
110      }
111      else
112      {
113        TabControl.setActiveTab(tabControlId, tabId);
114      }
115    }
116    </script>
117  </base:head>
118  <base:body attributes="onresize='setTimer();'">
119    <p>
120    <p:path>
121      <p:pathelement title="Experiments" href="<%="../index.jsp?ID="+ID%>" />
122      <p:pathelement title="<%=HTML.encodeTags(experiment.getName())%>" />
123    </p:path>
124 
125    <t:tabcontrol id="main" active="overview" switch="switchTab">
126    <t:tab id="properties" title="Properties" />
127    <t:tab id="bioassaysets" title="Bioassay sets" />
128    <t:tab id="overview" title="Overview">
129      <iframe name="overview" id="idOverview" src="frameset.jsp?ID=<%=ID%>" width="100%" 
130        frameborder="0" vspace="0" hspace="0"
131        marginwidth="0" marginheight="0" scrolling="no" style="overflow: visible"></iframe>
132    </t:tab>
133    </t:tabcontrol>
134  </base:body>
135  </base:page>
136  <%
137}
138finally
139{
140  if (dc != null) dc.close();
141}
142%>
Note: See TracBrowser for help on using the repository browser.