source: extensions/net.sf.basedb.reggie/trunk/resources/allprep_protocol.jsp @ 1637

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

References #388: Lysate wizard

It is possible to select 12 lysate items and then generate a printable lab protocol. We do not suggest or store a date yet.

File size: 5.6 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<style>
30
31</style>
32 
33<script language="JavaScript">
34var debug = false;
35var currentStep = 1;
36var lysatesIsValid = false;
37
38var WELL_ALPHA = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
39
40function init()
41{
42  var frm = document.forms['reggie'];
43
44  var lysates = getUnprocessedLysates();
45 
46  var lysateList = frm.lysates;
47  if (lysates != null && lysates.length > 0)
48  {
49    for (var i=0; i < lysates.length; i++)
50    {
51      var lysate = lysates[i];
52      var name = (i+1) + ': ' + lysate.name;
53      if (lysate.bioWell)
54      {
55        name += ' -- ' + lysate.bioWell.bioPlate.name + ' (' + WELL_ALPHA[lysate.bioWell.row]+(lysate.bioWell.column+1)+')';
56      }
57      var selected = i < 12;
58      var option = new Option(name, lysate.id, selected, selected);
59      option.lysate = lysate;
60      lysateList.options[lysateList.length] = option;
61    }
62    lysatesOnChange();
63  }
64  else
65  { 
66    setInputStatus('lysate', 'No Lysate available for processing.', 'invalid');
67  }
68  Main.show('gonext');
69}
70
71function getUnprocessedLysates()
72{
73  var frm = document.forms['reggie']; 
74 
75  var request = Ajax.getXmlHttpRequest();
76  try
77  {
78    showLoadingAnimation('Loading RNA extracts...');
79    var url = 'Extraction.servlet?ID=<%=ID%>&cmd=GetUnprocessedLysates';   
80    request.open("GET", url, false); 
81    request.send(null);
82  }
83  finally
84  {
85    hideLoadingAnimation();
86  }
87 
88  if (debug) Main.debug(request.responseText);
89  var response = JSON.parse(request.responseText); 
90  if (response.status != 'ok')
91  {
92    setFatalError(response.message);
93    return false;
94  }
95  return response.lysates;
96}
97
98function step1IsValid()
99{
100  return lysatesIsValid;
101}
102
103function goCreate()
104{
105  if (!step1IsValid()) return;
106  var frm = document.forms['reggie'];
107  frm.submit();
108}
109
110function lysatesOnChange()
111{
112  lysatesIsValid = false;
113 
114  var frm = document.forms['reggie'];
115  var lysateList = frm.lysates;
116 
117  var numSelected = 0;
118  for (var i = 0; i < lysateList.length; i++)
119  {
120    if (lysateList[i].selected) numSelected++;
121  }
122 
123  if (numSelected != 12)
124  {
125    setInputStatus('lysate', 'Must select 12 items.', 'invalid');
126    return;
127  }
128 
129  lysatesIsValid = true;
130  setInputStatus('lysate', '', 'valid');
131
132}
133
134</script>
135
136
137</base:head>
138<base:body onload="init()">
139
140  <p:path><p:pathelement 
141    title="Reggie" href="<%="index.jsp?ID="+ID%>" 
142    /><p:pathelement title="Lysis, Qiacube and NanoDrop processing sheet" 
143    /></p:path>
144
145  <div class="content">
146  <%
147  if (sc.getActiveProjectId() == 0)
148  {
149    %>
150    <div class="messagecontainer note" style="width: 800px; margin-left: 20px; margin-bottom: 20px; margin-right: 0px; font-weight: bold; color: #cc0000;">
151      No project has been selected. You may proceed with the registration but
152      created items will not be shared.
153    </div>
154    <%
155  }
156  %> 
157
158  <form name="reggie" onsubmit="return false;" action="allprep_protocol2.jsp?ID=<%=ID%>" method="post" target="_new">
159 
160  <!-- 1. Case name-->
161  <table border="0" cellspacing="0" cellpadding="0" class="stepform">
162  <tr>
163    <td rowspan="3" class="stepno">1</td>
164    <td class="steptitle">Select unprocessed lysate items</td>
165  </tr>
166  <tr>
167    <td class="stepfields">
168      <table border="0" cellspacing="0" cellpadding="0" width="100%">
169      <tr valign="top">
170        <td class="prompt">Lysate</td>
171        <td class="input" rowspan="2">
172          <select style="width:90%" name="lysates" id="lysates" multiple="multiple" size="15" onchange="lysatesOnChange()"></select>
173        </td>
174        <td class="status" id="lysate.status" rowspan="2"></td>
175        <td class="help" rowspan="2"><span id="lysate.message" class="message" style="display: none;"></span>
176          Select 12 items. The list contain Lysate items that has not yet been processed
177          (determined by absence of a 'creation' date).
178        </td>
179      </tr>
180      </table>
181    </td>
182  </tr>
183  </table>
184   
185  <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>
186 
187  <div class="messagecontainer error" id="errorMessage" style="display: none; width: 800px; margin-left: 20px; margin-bottom: 0px;"></div>
188 
189  <div id="done" class="success" style="display: none; width: 800px; margin-left: 20px; margin-top: 20px;"></div>
190 
191  <table style="margin-left: 20px; margin-top: 10px;" class="navigation" id="navigation">
192    <tr>
193      <td><base:button id="gocreate" title="Next" image="<%=home+"/images/gonext.png"%>" onclick="goCreate()" /></td>
194      <td id="gonext.message" class="message"></td>
195    </tr>
196  </table>
197  </form>
198  </div>
199 
200</base:body>
201</base:page>
202<%
203}
204finally
205{
206  if (dc != null) dc.close();
207}
208%>
Note: See TracBrowser for help on using the repository browser.