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

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

References #424: Select RNA items for library preparation

Add link to "Case summary" in the context menu in the "Select RNA" wizard and in the "Flagged RNA" dialog.

Add support for showing the "Case summary" as a popup window.

File size: 5.2 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    document.getElementById('remainingQuantity.'+i).innerHTML = rna.remainingQuantity;
49    document.getElementById('qualityScore.'+i).innerHTML = rna.rqs || rna.rin;
50    document.getElementById('comment.'+i).innerHTML = rna.comment || '';
51    document.getElementById('flag.'+i).innerHTML = rna.flag;
52    if (rna.flag == 'NotEnoughRemainingQuantity')
53    {
54      makeBold('remainingQuantity.'+i)
55    }
56    else if (rna.flag == 'LowQualityScore')
57    {
58      makeBold('qualityScore.'+i)
59    }
60    else
61    {
62      makeBold('comment.'+i);
63    }
64    frm['use.'+i].rna = rna;
65  }
66}
67
68function makeBold(elementId)
69{
70  Main.addClass(document.getElementById(elementId), 'bold');
71}
72
73function useSelected()
74{
75  var frm = document.forms['flaggedRna'];
76  var i = 0;
77  while (frm['use.'+i])
78  {
79    if (frm['use.'+i].checked)
80    {
81      var rna = frm['use.'+i].rna;
82      window.opener.setRnaCallback(rna.id, rna.name);
83    }
84    i++;
85  }
86  window.close();
87}
88function unflagSelected()
89{
90  var frm = document.forms['flaggedRna'];
91  var i = 0;
92  while (frm['use.'+i])
93  {
94    if (frm['use.'+i].checked)
95    {
96      var rna = frm['use.'+i].rna;
97      window.opener.Rna.unflag(window.opener.Rna.createByName(rna.name));
98    }
99    i++;
100  }
101  window.opener.updateNumFlaggedRna();
102  window.close();
103}
104
105function showCaseSummary(name)
106{
107  var caseName = name.substring(0, 7);
108  var url = '../reports/case_summary.jsp?ID=<%=ID%>&caseName='+encodeURIComponent(caseName);
109  url += '&pageType=popup';
110  Main.openPopup(url, 'CaseSummary'+caseName, 1000, 700);
111}
112
113</script>
114
115<style>
116.bold
117{
118  color: #C80000;
119  font-weight: bold;
120}
121
122.case-summary
123{
124  padding-left: 4px;
125}
126</style>
127
128</base:head>
129<base:body onload="init()">
130  <h1><%=title %></h1>
131
132  <div class="content">
133  <tbl:table id="flaggedRna" subclass="fulltable">
134    <tbl:columndef id="rna" title="RNA" />
135    <tbl:columndef id="location" title="Bioplate" />
136    <tbl:columndef id="remainingQuanity" title="Remaining (µg)" />
137    <tbl:columndef id="qualityScore" title="RQS/RIN" />
138    <tbl:columndef id="comment" title="Comment" />
139    <tbl:columndef id="flag" title="Flag" />
140 
141    <tbl:data style="top: 0px; margin-top: 0px;">
142      <tbl:headers>
143        <tbl:headerrow>
144          <th></th>
145          <tbl:columnheaders />
146        </tbl:headerrow>
147      </tbl:headers>
148      <tbl:rows>
149      <%
150      for (int i = 0; i < numFlagged; ++i)
151      {
152        %>
153        <tbl:row>
154          <td style="text-align: center; width: 20px;"><input type="checkbox" name="use.<%=i%>"></td>
155          <tbl:cell column="rna" id="<%="rna."+i%>"><%=i%></tbl:cell>
156          <tbl:cell column="location" id="<%="location."+i%>"></tbl:cell>
157          <tbl:cell column="remainingQuanity" id="<%="remainingQuantity."+i%>"></tbl:cell>
158          <tbl:cell column="qualityScore" id="<%="qualityScore."+i%>"></tbl:cell>
159          <tbl:cell column="comment" id="<%="comment."+i%>"></tbl:cell>
160          <tbl:cell column="flag" id="<%="flag."+i%>"></tbl:cell>
161        </tbl:row>
162        <%
163      }
164      %>
165      </tbl:rows>
166    </tbl:data>
167  </tbl:table>
168  </div>
169
170  <base:buttongroup subclass="dialogbuttons" id="dialogbuttons">
171    <base:button onclick="useSelected()" title="Use selected" 
172      disabled="<%=numSelected == 0%>" tooltip="Use the RNA and ignore the flag"
173      image="<%=home + "/images/manual_rna.png"%>" />
174    <base:button onclick="unflagSelected()" title="Unflag" 
175      image="<%=home+"/images/unflag.png"%>" tooltip="Do not flag the selected RNA" />
176    <base:button onclick="window.close()" title="Close" />
177  </base:buttongroup>
178</base:body>
179</base:page>
180<%
181}
182finally
183{
184  if (dc != null) dc.close();
185}
186%>
Note: See TracBrowser for help on using the repository browser.