source: extensions/net.sf.basedb.reggie/trunk/resources/allprep_protocol2.jsp @ 1849

Last change on this file since 1849 was 1849, checked in by Nicklas Nordborg, 7 years ago

References #462: Implement a print function that can print complete pages

Implemented a javascript function that opens a popup window and copies the content of a specified html tag (given by the id) to the popup window.

openPrintWindow(ID, printElementId, pageTitle, pageOrientation, printNote)

The change also includes printing changes made in separate branch for #425 in [1723].

File size: 4.4 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.core.Extract"
9  import="net.sf.basedb.core.BioMaterial"
10  import="net.sf.basedb.core.BioMaterialEventSource"
11  import="net.sf.basedb.core.BioPlate"
12  import="net.sf.basedb.core.BioWell"
13  import="net.sf.basedb.core.PermissionDeniedException"
14  import="net.sf.basedb.util.Values"
15  import="net.sf.basedb.util.extensions.Extension"
16  import="net.sf.basedb.clients.web.Base" 
17  import="net.sf.basedb.clients.web.util.HTML"
18  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
19  import="java.util.List"
20  import="java.util.ArrayList"
21%>
22<%
23final SessionControl sc = Base.getExistingSessionControl(request, true);
24final String ID = sc.getId();
25final float scale = Base.getScale(sc);
26final String home = ExtensionsControl.getHomeUrl("net.sf.basedb.reggie");
27final int BLOCKS_PER_PAGE = 3;
28DbControl dc = null;
29try
30{
31  dc = sc.newDbControl();
32  final Extension reggie = ExtensionsControl.get(dc).getExtension("net.sf.basedb.reggie");
33  final User user = User.getById(dc, sc.getLoggedInUserId());
34  List<Extract> lysates = new ArrayList<Extract>();
35  for (String id : request.getParameterValues("lysates"))
36  {
37    lysates.add(Extract.getById(dc, Values.getInt(id)));
38  }
39%>
40<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
41<html>
42<head>
43  <title>Lab Tracking Protocol for Allprep isolation</title>
44  <link rel="SHORTCUT ICON" href="<%=home%>/images/extraction.png">
45  <link rel="stylesheet" type="text/css" href="<%=home %>/css/printable.css">
46  <style>
47 
48  table.protocolheader
49  {
50    width: 100%;
51  }
52
53  table.protocolheader > tbody > tr
54  {
55    height: 2em;
56  }
57
58  table.protocolheader > tbody > tr > th
59  {
60    width: 50%;
61    text-align: left;
62    font-size: 1.25em;
63  }
64 
65  table.samplelist
66  {
67    width: 100%;
68    border-collapse: collapse;
69    border: 1px solid #000000;
70  }
71 
72  table.samplelist > tbody > tr
73  {
74    height: 1.7cm;
75  }
76 
77  table.samplelist > tbody > tr > th
78  {
79    border: 1px solid #000000;
80    font-size: 1.25em;
81  }
82 
83  table.samplelist > tbody > tr > td
84  {
85    border: 1px solid #000000;
86    vertical-align: middle;
87    font-size: 1.25em;
88    padding: 0.5em;
89  }
90 
91  .name
92  {
93    font-weight: bold;
94    width: 20%;
95  }
96  .box
97  {
98    width: 20%;
99  }
100  .qiacube
101  {
102    width: 15%;
103    text-align: center;
104  }
105  table.samplelist > tbody > tr > td.remark
106  {
107    width: 45%;
108    font-size: 0.85em;
109    vertical-align: top;
110  }
111 
112  </style>
113</head>
114<body>
115  <div class="paper">
116  <div class="noprint fullwidth" style="border-bottom: 1px dashed #A0A0A0; padding-left: 1em; padding-bottom: 1em;">
117    <span class="button" onclick="window.print()">
118      <img src="images/print.png">Print&hellip;
119    </span>
120  </div>
121 
122  <h1>Lab Tracking Protocol for Allprep isolation v.1.2</h1>
123
124  <table style="width: 100%; border: 0px;" class="protocolheader">
125  <tr>
126    <td colspan="2">Reggie <%=reggie.getAbout().getVersion() %>; Page 1 of 1</td>
127  </tr>
128  <tr>
129    <th style="width: 50%;">Date for lysis:</th>
130    <th style="width: 50%;">Operator:</th>
131  </tr>
132  <tr>
133    <th style="width: 50%;">Date for isolation:</th>
134    <th style="width: 50%;">Operator:</th>
135  </tr>
136  </table>
137
138  <table style="width: 100%;" class="samplelist">
139  <tr>
140    <th class="name">Sample</th>
141    <th class="box">Storage box</th>
142    <th class="qiacube">Qiacube position</th>
143    <th class="remark">Remark</th>
144  </tr>
145  <%
146  int index = 1;
147  for (Extract lysate : lysates)
148  {
149    BioMaterial specimen = lysate.getParent();
150    Float usedQuantity = null;
151    if (specimen != null) 
152    {
153      BioMaterialEventSource source = lysate.getCreationEvent().getEventSource(specimen);
154      usedQuantity = source.getUsedQuantity();
155    }
156    BioWell well = lysate.getBioWell();
157    BioPlate plate = well.getPlate();
158    %>
159    <tr>
160      <td class="name"><%=lysate.getName() %></td>
161      <td class="box"><%=plate.getName() %> <%=well.getCoordinate() %></td>
162      <td class="qiacube"><%=index %></td>
163      <td class="remark">
164        <%
165        if (usedQuantity != null)
166        {
167          %>
168          ApWeight: <%=Values.formatNumber(usedQuantity / 1000, 0, "mg") %>
169          <%
170        }
171        %>
172      </td>
173    </tr>
174    <%
175    ++index;
176  }
177  %>
178  </table>
179  </div>
180</body>
181</html>
182<%
183}
184finally
185{
186  if (dc != null) dc.close();
187}
188%>
Note: See TracBrowser for help on using the repository browser.