source: trunk/www/views/experiments/bioassaysets/edit_bioassayset.jsp @ 4910

Last change on this file since 4910 was 4910, checked in by Nicklas Nordborg, 13 years ago

References #1120: The dynamic part of BASE should keep track whether intensity data is in log space or not

Added this flag to bioassay set and made it possible to modify it in the web interface.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 7.5 KB
Line 
1<%-- $Id: edit_bioassayset.jsp 4910 2009-04-29 09:05:20Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
4  Copyright (C) 2007 Nicklas Nordborg
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 3
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with BASE. If not, see <http://www.gnu.org/licenses/>.
21  ------------------------------------------------------------------
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.ItemContext"
32  import="net.sf.basedb.core.Permission"
33  import="net.sf.basedb.core.Experiment"
34  import="net.sf.basedb.core.BioAssaySet"
35  import="net.sf.basedb.core.ItemQuery"
36  import="net.sf.basedb.core.ItemResultList"
37  import="net.sf.basedb.core.Include"
38  import="net.sf.basedb.core.query.Orders"
39  import="net.sf.basedb.core.query.Hql"
40  import="net.sf.basedb.core.PermissionDeniedException"
41  import="net.sf.basedb.core.BaseException"
42  import="net.sf.basedb.core.IntensityTransform"
43  import="net.sf.basedb.clients.web.Base"
44  import="net.sf.basedb.clients.web.util.HTML"
45  import="net.sf.basedb.util.Values"
46  import="java.util.Date"
47%>
48<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
49<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
50<%
51final Item itemType = Item.BIOASSAYSET;
52final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
53final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
54final int itemId = cc.getId();
55final String ID = sc.getId();
56final float scale = Base.getScale(sc);
57final DbControl dc = sc.newDbControl();
58try
59{
60  BioAssaySet bioAssaySet = BioAssaySet.getById(dc, itemId);
61
62  cc.setObject("item", bioAssaySet);
63  String title = "Edit bioassay set -- " + HTML.encodeTags(bioAssaySet.getName());
64  if (bioAssaySet != null)
65  {
66    bioAssaySet.checkPermission(Permission.WRITE);
67  }
68  final String clazz = "class=\"text\"";
69  final String requiredClazz = "class=\"text required\"";
70  %>
71  <base:page type="popup" title="<%=title%>">
72  <base:head scripts="tabcontrol.js,annotations.js" styles="tabcontrol.css">
73    <script language="JavaScript">
74    // Validate the "BioAssaySet" tab
75    function validateBioAssaySet()
76    {
77      var frm = document.forms['bioAssaySet'];
78      if (Main.trimString(frm.name.value) == '')
79      {
80        alert("You must enter a name");
81        frm.name.focus();
82        return false;
83      }
84      return true;
85    }
86
87    // Submit the form
88    function saveSettings()
89    {
90      var frm = document.forms['bioAssaySet'];
91      if (TabControl.validateActiveTab('settings'))
92      {
93        if (annotationsLoaded)
94        {
95          Annotations.addModifiedAnnotationsToForm(frames.annotations, frm);
96        }
97        if (inheritedAnnotationsLoaded)
98        {
99          Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm);
100        }
101        frm.submit();
102      }
103    }
104   
105    var annotationsLoaded = false;
106    var inheritedAnnotationsLoaded = false;
107    var parentsChanged = false;
108    var protocolChanged = false;
109    function switchTab(tabControlId, tabId)
110    {
111      if (TabControl.setActiveTab(tabControlId, tabId))
112      {
113        if (tabId == 'annotations' && (protocolChanged || !annotationsLoaded))
114        {
115          Annotations.loadAnnotateFrame(frames.annotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getProtocolId());
116          annotationsLoaded = true;
117          protocolChanged = false;
118        }
119        else if (tabId == 'inheritedAnnotations' && 
120          (parentsChanged || !inheritedAnnotationsLoaded))
121        {
122          Annotations.loadInheritFrame(frames.inheritedAnnotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getParents());
123          inheritedAnnotationsLoaded = true;
124          parentsChanged = false;
125        }
126      }
127    }
128   
129    function getProtocolId()
130    {
131      // No protocol
132      return 0;
133    }
134   
135    function getParents()
136    {
137      // Parents are always fixed and if we pass null they will be loaded by
138      // the annotate.jsp page
139      return null;
140    }
141   
142    function init()
143    {
144      var frm = document.forms['bioAssaySet'];
145      <%
146      if (bioAssaySet == null)
147      {
148        %>
149        frm.name.focus();
150        frm.name.select();
151        <%
152      }
153      %>
154    }
155    </script>
156  </base:head>
157  <base:body onload="init()">
158    <p>
159    <form action="index.jsp?ID=<%=ID%>" method="post" name="bioAssaySet" onsubmit="return false;">
160    <input type="hidden" name="cmd" value="UpdateItem">
161
162    <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3>
163    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" 
164      position="bottom"  remember="<%=bioAssaySet != null%>" switch="switchTab">
165    <t:tab id="info" title="Bioassay set" validate="validateBioAssaySet()" helpid="bioassayset.edit">
166      <table class="form" cellspacing=0>
167      <tr>
168        <td class="prompt">Name</td>
169        <td><input <%=requiredClazz%> type="text" name="name" 
170          value="<%=HTML.encodeTags(bioAssaySet == null ? Values.getString(cc.getPropertyValue("name"), "New bioassay set") : bioAssaySet.getName())%>" 
171          size="40" maxlength="<%=BioAssaySet.MAX_NAME_LENGTH%>"></td>
172      </tr>
173      <tr>
174        <td class="prompt">Spot intensity<br>transformation</td>
175        <td>
176          <select name="intensityTransform">
177          <%
178          IntensityTransform transform = bioAssaySet.getIntensityTransform();
179          for (IntensityTransform t : IntensityTransform.values())
180          {
181            String selected = transform == t ? "selected" : "";
182            %>
183            <option value="<%=t.name()%>" <%=selected%>><%=t.toString()%>
184            <%
185          }
186          %>
187          </select>
188        </td>
189      </tr>
190
191      <tr valign=top>
192        <td class="prompt">Description</td>
193        <td nowrap>
194          <textarea <%=clazz%> rows="4" cols="40" name="description" wrap="virtual"
195            ><%=HTML.encodeTags(bioAssaySet == null ? cc.getPropertyValue("description") : bioAssaySet.getDescription())%></textarea>
196          <a href="javascript:Main.zoom('Description', 'bioAssaySet', 'description')"
197            title="Edit in larger window"><base:icon image="zoom.gif" /></a>
198        </td>
199      </tr>
200      </table>
201      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
202    </t:tab>
203    <t:tab id="annotations" title="Annotations" 
204      helpid="annotations.edit" tooltip="Enter values for annotations">
205      <iframe name="annotations" id="idAnnotations" src="../../../common/annotations/wait.jsp" 
206        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
207        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
208    </t:tab>
209   
210    <t:tab id="inheritedAnnotations" title="Inherited annotations" helpid="annotations.edit.inherited">
211      <iframe name="inheritedAnnotations" id="idInheritedAnnotations" src="../../../common/annotations/wait.jsp" 
212        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
213        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
214    </t:tab>
215    </t:tabcontrol>
216
217    <table align="center">
218    <tr>
219      <td width="50%"><base:button onclick="saveSettings()" title="Save" /></td>
220      <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td>
221    </tr>
222    </table>
223    </form>
224  </base:body>
225  </base:page>
226  <%
227}
228finally
229{
230  if (dc != null) dc.close();
231}
232%>
Note: See TracBrowser for help on using the repository browser.