source: extensions/net.sf.basedb.reggie/branches/ticket-422/resources/libprep/mrna_protocol.jsp @ 1759

Last change on this file since 1759 was 1759, checked in by Nicklas Nordborg, 10 years ago

References #440: Export data to files needed for mRNA/cDNA processing

Added a mockup for this that uses the same wizard as the 'lab protocol wizard' (#425).

File size: 6.3 KB
Line 
1<%@ page
2  pageEncoding="UTF-8"
3  session="false"
4  import="net.sf.basedb.core.User"
5  import="net.sf.basedb.core.DbControl"
6  import="net.sf.basedb.core.SessionControl"
7  import="net.sf.basedb.core.Application"
8  import="net.sf.basedb.clients.web.Base" 
9  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
10%>
11<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
12<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
13<%
14final SessionControl sc = Base.getExistingSessionControl(request, true);
15final String ID = sc.getId();
16final float scale = Base.getScale(sc);
17final String home = ExtensionsControl.getHomeUrl("net.sf.basedb.reggie");
18DbControl dc = null;
19try
20{
21  dc = sc.newDbControl();
22  final User user = User.getById(dc, sc.getLoggedInUserId());
23%>
24<base:page type="default" >
25<base:head scripts="ajax.js" styles="path.css">
26  <link rel="stylesheet" type="text/css" href="../css/reggie.css">
27  <script language="JavaScript" src="../reggie.js" type="text/javascript" charset="UTF-8"></script>
28
29<script language="JavaScript">
30var debug = true;
31var currentStep = 1;
32
33function init()
34{
35  var frm = document.forms['reggie'];
36  var bioplates = getMRnaBioPlates();
37 
38  var plates = frm.bioplate;
39  if (bioplates != null && bioplates.length > 0)
40  {
41    for (var i=0; i < bioplates.length; i++)
42    {
43      var bioplate = bioplates[i];
44      var option = new Option(bioplate.name, bioplate.id);
45      plates.options[plates.length] = option;
46    }
47    bioplateIsValid = true;
48    Main.show('gocreate');
49  }
50  else
51  {
52    var msg = 'No mRNA bioplates available for processing.';
53    setFatalError(msg);
54  }
55 
56  var configurations = []; // TODO - get configurations by AJAX
57  var exportHtml = makeButton('Sample names for BA (csv) -- TODO', "goExport('SAMPLE_NAMES_BA')");
58  for (var i = 0; i < configurations.length; i++)
59  {
60    var config = configurations[i];
61    exportHtml += makeButton('Run parameters: '+config.name + ' (xml)', "goExport('"+config.id+"')");
62  }
63  setInnerHTML('export', exportHtml);
64
65}
66
67function makeButton(title, onClick)
68{
69  var btn = '';
70  btn += '<span class="link" onclick="'+onClick+'">';
71  btn += '<img src="../images/export.png">&nbsp;';
72  btn += title+'</span><br>\n';
73  return btn;
74}
75
76
77function getMRnaBioPlates()
78{
79  var frm = document.forms['reggie'];
80 
81  var request = Ajax.getXmlHttpRequest();
82  try
83  {
84    showLoadingAnimation('Loading histology work lists...');
85    var url = '../MRna.servlet?ID=<%=ID%>&cmd=GetUnprocessedMRnaPlates';   
86    request.open("GET", url, false); 
87    request.send(null);
88  }
89  finally
90  {
91    hideLoadingAnimation();
92  }
93 
94  if (debug) Main.debug(request.responseText);
95  var response = JSON.parse(request.responseText); 
96  if (response.status != 'ok')
97  {
98    setFatalError(response.message);
99    return false;
100  }
101  return response.bioplates;
102}
103
104function viewProtocol(type)
105{
106  var frm = document.forms['reggie'];
107  if (frm.bioplate && !frm.bioplate.disabled)
108  {
109    frm.view.value = type;
110    frm.submit();
111  }
112}
113
114function goExport(exporter)
115{
116  var frm = document.forms['reggie'];
117  if (frm.bioplate && !frm.bioplate.disabled)
118  {
119    alert('Not implemented');
120  }
121}
122
123</script>
124
125</base:head>
126<base:body onload="init()">
127
128  <p:path><p:pathelement 
129    title="Reggie" href="<%="../index.jsp?ID="+ID%>" 
130    /><p:pathelement title="Lab tracking protocol for mRNA and cDNA preparation" 
131    /></p:path>
132
133  <div class="content">
134  <%
135  if (sc.getActiveProjectId() == 0)
136  {
137    %>
138    <div class="messagecontainer note" style="width: 950px; margin-left: 20px; margin-bottom: 20px; margin-right: 0px; font-weight: bold; color: #cc0000;">
139      No project has been selected. You may proceed with the registration but
140      created items will not be shared.
141    </div>
142    <%
143  }
144  %>
145
146  <form name="reggie" onsubmit="return false;" action="mrna_protocol2.jsp" method="post" target="_new">
147  <input type="hidden" name="ID" value="<%=ID%>">
148  <input type="hidden" name="view" value="list">
149 
150  <table class="stepform">
151  <tr>
152    <td rowspan="3" class="stepno">1</td>
153    <td class="steptitle">Select mRNA bioplate</td>
154  </tr>
155  <tr>
156    <td class="stepfields">
157      <table>
158      <tr valign="top">
159        <td class="prompt">mRNA bioplate</td>
160        <td class="input"><select style="width:90%" 
161            name="bioplate" id="bioplate"></select>
162        </td>
163        <td class="status" id="bioplate.status"></td>
164        <td class="help"><span id="bioplate.message" class="message" style="display: none;"></span>
165          Select an existing mRNA bioplate. The list contain all mRNA bioplates that
166          has not yet been processed (determined by the absence of a 'creation' date).
167        </td>
168      </tr>
169      <tr valign="top">
170        <td class="prompt">Lab protocols</td>
171        <td class="input" id="protocol" style="white-space: nowrap; line-height: 1.5em;">
172          <span class="link" onclick="viewProtocol('list')"><img src="../images/listview.png">&nbsp;List layout</span><br>
173          <span class="link" onclick="viewProtocol('plate')"><img src="../images/plateview.png">&nbsp;Plate layout</span><br>
174        </td>
175        <td class="status" id="protocol.status"></td>
176        <td class="help"><span id="protocol.message" class="message" style="display: none;"></span>
177          The 'list layout' generates a table with one row for each well on the work plate.
178          The 'plate layout' generates a grid with wells arranged according to row and column coordinates.
179        </td>
180      </tr>
181      <tr valign="top">
182        <td class="prompt">Export files</td>
183        <td class="input" id="export" style="white-space: nowrap; line-height: 1.5em;">
184          TODO
185        </td>
186        <td class="status" id="export.status"></td>
187        <td class="help"><span id="protocol.message" class="message" style="display: none;"></span>
188          Select what to export. Typically, you'll need the .... files.
189        </td>
190      </tr>
191      </table>
192    </td>
193  </tr>
194  </table>
195 
196  <div class="loading" id="loading" style="display: none;"><table><tr><td><img src="images/loading.gif"></td><td id="loading.msg">Please wait...</td></tr></table></div>
197 
198  <div class="messagecontainer error" id="errorMessage" style="display: none; width: 950px; margin-left: 20px; margin-bottom: 0px;"></div>
199 
200  <div id="done" class="success" style="display: none; width: 950px; margin-left: 20px; margin-top: 20px;"></div>
201 
202  </form>
203  </div>
204 
205</base:body>
206</base:page>
207<%
208}
209finally
210{
211  if (dc != null) dc.close();
212}
213%>
Note: See TracBrowser for help on using the repository browser.