source: extensions/net.sf.basedb.reggie/trunk/resources/libprep/show_flagged_rna.jsp @ 2142

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

Fixes #535: The Flagged RNA dialog doesn't round numeric values

File size: 5.3 KB
Line 
1<%@ page
2  pageEncoding="UTF-8"
3  session="false"
4  import="net.sf.basedb.core.Application"
5  import="net.sf.basedb.core.User"
6  import="net.sf.basedb.core.DbControl"
7  import="net.sf.basedb.core.SessionControl"
8  import="net.sf.basedb.clients.web.Base"
9  import="net.sf.basedb.clients.web.util.HTML"
10  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
11  import="net.sf.basedb.util.Values"
12%>
13<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
14<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
15
16<%
17final SessionControl sc = Base.getExistingSessionControl(request, true);
18final String ID = sc.getId();
19final float scale = Base.getScale(sc);
20final String home = ExtensionsControl.getHomeUrl("net.sf.basedb.reggie");
21DbControl dc = null;
22try
23{
24  dc = sc.newDbControl();
25  final User user = User.getById(dc, sc.getLoggedInUserId());
26  final String title = "Flagged RNA items";
27  final int numFlagged = Values.getInt(request.getParameter("numFlagged"));
28  final int numSelected = Values.getInt(request.getParameter("numSelected"));
29%>
30<base:page type="popup" title="<%=title%>">
31<base:head scripts="table.js" styles="table.css">
32<script language="JavaScript" src="../reggie.js" type="text/javascript" charset="UTF-8"></script>
33<script>
34
35function init()
36{
37  var flagged = window.opener.Rna.getFlagged();
38  var frm = document.forms['flaggedRna'];
39  for (var i = 0; i < flagged.length; i++)
40  {
41    var rna = flagged[i];
42    document.getElementById('rna.'+i).innerHTML = rna.name+'<img class="link case-summary" onclick="showCaseSummary(\''+rna.name+'\')" src="../images/case_summary.png">';
43    if (rna.bioWell)
44    {
45      var well = rna.bioWell;
46      document.getElementById('location.'+i).innerHTML = well.bioPlate.name +' ['+WELL_ALPHA[well.row]+(well.column+1)+']';
47    }
48    var qs = rna.rqs || rna.rin;
49    document.getElementById('remainingQuantity.'+i).innerHTML = Numbers.formatNumber(rna.remainingQuantity, 2);
50    document.getElementById('qualityScore.'+i).innerHTML = Numbers.formatNumber(qs, qs < -10 ? 0 : 1);
51    document.getElementById('comment.'+i).innerHTML = rna.comment || '';
52    document.getElementById('flag.'+i).innerHTML = rna.flag;
53    if (rna.flag == 'NotEnoughRemainingQuantity')
54    {
55      makeBold('remainingQuantity.'+i)
56    }
57    else if (rna.flag == 'LowQualityScore')
58    {
59      makeBold('qualityScore.'+i)
60    }
61    else
62    {
63      makeBold('comment.'+i);
64    }
65    frm['use.'+i].rna = rna;
66  }
67}
68
69function makeBold(elementId)
70{
71  Main.addClass(document.getElementById(elementId), 'bold');
72}
73
74function useSelected()
75{
76  var frm = document.forms['flaggedRna'];
77  var i = 0;
78  while (frm['use.'+i])
79  {
80    if (frm['use.'+i].checked)
81    {
82      var rna = frm['use.'+i].rna;
83      window.opener.setRnaCallback(rna.id, rna.name);
84    }
85    i++;
86  }
87  window.close();
88}
89function unflagSelected()
90{
91  var frm = document.forms['flaggedRna'];
92  var i = 0;
93  while (frm['use.'+i])
94  {
95    if (frm['use.'+i].checked)
96    {
97      var rna = frm['use.'+i].rna;
98      window.opener.Rna.unflag(window.opener.Rna.createByName(rna.name));
99    }
100    i++;
101  }
102  window.opener.updateNumFlaggedRna();
103  window.close();
104}
105
106function showCaseSummary(name)
107{
108  var caseName = name.substring(0, 7);
109  var url = '../reports/case_summary.jsp?ID=<%=ID%>&caseName='+encodeURIComponent(caseName);
110  url += '&pageType=popup';
111  Main.openPopup(url, 'CaseSummary'+caseName, 1000, 700);
112}
113
114</script>
115
116<style>
117.bold
118{
119  color: #C80000;
120  font-weight: bold;
121}
122
123.case-summary
124{
125  padding-left: 4px;
126}
127</style>
128
129</base:head>
130<base:body onload="init()">
131  <h1><%=title %></h1>
132
133  <div class="content">
134  <tbl:table id="flaggedRna" subclass="fulltable">
135    <tbl:columndef id="rna" title="RNA" />
136    <tbl:columndef id="location" title="Bioplate" />
137    <tbl:columndef id="remainingQuanity" title="Remaining (µg)" />
138    <tbl:columndef id="qualityScore" title="RQS/RIN" />
139    <tbl:columndef id="comment" title="Comment" />
140    <tbl:columndef id="flag" title="Flag" />
141 
142    <tbl:data style="top: 0px; margin-top: 0px;">
143      <tbl:headers>
144        <tbl:headerrow>
145          <th></th>
146          <tbl:columnheaders />
147        </tbl:headerrow>
148      </tbl:headers>
149      <tbl:rows>
150      <%
151      for (int i = 0; i < numFlagged; ++i)
152      {
153        %>
154        <tbl:row>
155          <td style="text-align: center; width: 20px;"><input type="checkbox" name="use.<%=i%>"></td>
156          <tbl:cell column="rna" id="<%="rna."+i%>"><%=i%></tbl:cell>
157          <tbl:cell column="location" id="<%="location."+i%>"></tbl:cell>
158          <tbl:cell column="remainingQuanity" id="<%="remainingQuantity."+i%>"></tbl:cell>
159          <tbl:cell column="qualityScore" id="<%="qualityScore."+i%>"></tbl:cell>
160          <tbl:cell column="comment" id="<%="comment."+i%>"></tbl:cell>
161          <tbl:cell column="flag" id="<%="flag."+i%>"></tbl:cell>
162        </tbl:row>
163        <%
164      }
165      %>
166      </tbl:rows>
167    </tbl:data>
168  </tbl:table>
169  </div>
170
171  <base:buttongroup subclass="dialogbuttons" id="dialogbuttons">
172    <base:button onclick="useSelected()" title="Use selected" 
173      disabled="<%=numSelected == 0%>" tooltip="Use the RNA and ignore the flag"
174      image="<%=home + "/images/manual_rna.png"%>" />
175    <base:button onclick="unflagSelected()" title="Unflag" 
176      image="<%=home+"/images/unflag.png"%>" tooltip="Do not flag the selected RNA" />
177    <base:button onclick="window.close()" title="Close" />
178  </base:buttongroup>
179</base:body>
180</base:page>
181<%
182}
183finally
184{
185  if (dc != null) dc.close();
186}
187%>
Note: See TracBrowser for help on using the repository browser.