source: extensions/net.sf.basedb.reggie/trunk/resources/personal/generate-referral-forms.jsp @ 4080

Last change on this file since 4080 was 4080, checked in by olle, 7 years ago

Refs #897. SCAN-B referral form generation updated to warn the user, when more than one referral template PDF file exists for a form creation type for the selected site, and require a check button to be checked before continuing. Multiple template files for the same form creation type are allowed, and will result in forms being generated for each template. The warning/confirmation discussed is intended to avoid unwanted versions of forms to be created, e.g. after new versions of templates have been installed, but the old versions have not been removed.

  1. JSP file generate-referral-forms.jsp in resources/personal/ updated for step 1 by adding new div tag with id "step1message" after the step table. The new tag will be used to display information on multiple template files for the same form creation type and selected site.
  2. Javascript file generate-referral-forms.js in resources/personal/ updated:
    a. Function initPage() updated to couple changes in menus for site and form set variant to new siteAndVariantOnChange() function. Also, the "Next" button will be disabled at start.
    b. Function sitesLoaded(response) updated to add new default option "- Select site -" to the site menu. The new default option has an empty string as value.
    c. New function siteAndVariantOnChange() added. It obtains values for site and form set variant, and if they are valid, calls servlet ReferralGeneratorServlet with new command "GetReferralTemplateInfo" and callback function preValidateStep1(response). If the values are invalid, the "Next" button is disabled (it may have been enabled by the user having selected valid menu options previously).
    d. New callback function preValidateStep1(response) added. It obtains a JSONArray of optional multiple template files. If the JSONArray is empty, the "Next" button is enabled, otherwise a JSONObject is obtained for each multiple template file and a table showing a list of filename and template type for multiple template files is added to div tag with id "step1message", and a confirmation check box is added with standard action Wizard.showGoNextConfirmation(...).
    e. Unused variables removed.
  3. Java servlet class/file in src/net/sf/basedb/reggie/servlet/ updated:
    a. Protected method void doGet(HttpServletRequest req, HttpServletResponse resp) updated with new command "GetReferralTemplateInfo". It obtains values for site and form set variant from the request, and calls new private method JSONArray fetchMultipleTemplateFiles(DbControl dc, String scanbIdPrefix, String formTemplateName, JSONArray jsonMultipleTemplFiles) for the relevant form template names to update a JSONArray with info on any multiple template files for the same form creation type and site. The JSONArray is added to the returned JSON object with JSON key "multTemplates".
    b. New private method JSONArray fetchMultipleTemplateFiles(DbControl dc, String scanbIdPrefix, String formTemplateName, JSONArray jsonMultipleTemplFiles) added. It returns a JSONArray of JSONObjects for multiple BASE file items for given form creation type and site.
File size: 6.0 KB
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  import="net.sf.basedb.util.formatter.DateFormatter"
14<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
15<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
17final SessionControl sc = Base.getExistingSessionControl(request, "net.sf.basedb.reggie", true);
18final String ID = sc.getId();
19final float scale = Base.getScale(sc);
20final String home = ExtensionsControl.getHomeUrl("net.sf.basedb.reggie");
22DbControl dc = null;
25  dc = sc.newDbControl();
26  final User user = User.getById(dc, sc.getLoggedInUserId());
27  DateFormatter dateFormat = new DateFormatter("yyyy-MM-dd");
29<base:page type="default" >
31  scripts="~../reggie-2.js,~generate-referral-forms.js" 
32  styles="path.css,~../css/reggie-2.css"
37  margin: 0 1em 0 4em;
38  padding: 0.5em 1em;
39  font-family: monospace,Courier New;
40  max-height: 25em;
41  overflow: auto;
47  <p:path><p:pathelement 
48    title="Reggie" href="<%="../index.jsp?ID="+ID%>" 
49    /><p:pathelement title="Generate referral forms" 
50    /></p:path>
52  <div class="content">
53  <form name="reggie" id="wizard" class="wizard">
55  <div class="step" id="step-1">
56    <div class="step-no">1</div>
57    <div class="step-title">Enter info on the referral form batch to create</div>
58    <div class="step-content">
60      <div class="bg-filled-50" style="padding: 2px;">
61        * A form set consists of forms with the same base SCAN-B ID, i.e. ignoring optional suffix.<br>
62        * A form batch consists of a number of form sets with consecutive SCAN-B ID's.<br>
63        * A form batch is distributed as two files, with forms intended for printing on<br>
64        &nbsp;&nbsp;&nbsp;referral form sheets or regular paper, respectively:<br>
65        <br>
66        &nbsp;&nbsp;&nbsp;Batch file 1: Form sets with 2 or 4 (Kit 2) forms to be printed on referral form sheets.<br>
67        &nbsp;&nbsp;&nbsp;Batch file 2: Form sets with 2 forms to be printed on regular paper.<br>
68        <br>
69        &nbsp;&nbsp;&nbsp;Printing options:<br>
70        <br>
71        &nbsp;&nbsp;&nbsp;Batch file 1: One-sided printing, one page per sheet, print size "Actual size".<br>
72        &nbsp;&nbsp;&nbsp;Batch file 2: Double-sided printing, two pages per sheet, print size "Actual size".<br>
73        <br> 
74      </div>
76      <table class="step-form">
77      <tr>
78        <td class="prompt">Site</td>
79        <td class="input">
80          <select id="sites" name="sites" style="width: 15em;"></select>
81        </td>
82        <td class="status" id="sites.status"></td>
83        <td class="help">
84          <span id="sites.message" class="message"></span>
85          Select what site to generate referral forms for.
86        </td>
87      </tr>
88      <tr>
89        <td class="prompt">Form set variant</td>
90        <td class="input">
91          <select name="referralvariant" id="referralvariant">
92            <option value="kit1_standard" selected="yes">Kit 1 - Standard</option>
93            <option value="kit2_neoadjuvant">Kit 2 - Neoadjuvant therapy</option>
94          </select>
95        </td>
96        <td valign="top" class="status" id="referralvariant.status"></td>
97        <td class="help">
98          <span id="referralvariant.message" class="message"></span>
99          Select form set variant.
100        </td>
101      </tr>
102      </table>
103      <div id="step1message"></div>
105    </div>
106  </div>
108  <div class="step" id="step-2">
109    <div class="step-no">2</div>
110    <div class="step-title">Referral form generation</div>
111    <div class="step-content">
113      <table class="step-form">
114      <tr>
115        <td class="prompt">Start SCAN-B ID</td>
116        <td class="input"><input type="text" name="caseName" id="caseName"
117          class="required auto-init" data-auto-init="focus"
118          style="width: 12em;" maxlength="12"></td>
119        <td class="status" id="caseName.status"></td>
120        <td class="help">
121          <span id="caseName.message" class="message"></span>
122          The 7-digit SCAN-B ID (barcode) for the first referral form set. Last updated: <b><span id="scanbIdLastUpdated"></span></b>.
123        </td>
124      </tr>
125      <tr>
126        <td class="prompt"># Form sets</td>
127        <td class="input"><input type="text" name="nofFormSets" id="nofFormSets"
128          class="required auto-init" data-auto-init="focus"
129          style="width: 12em;" maxlength="12"></td>
130        <td class="status" id="nofFormSets.status"></td>
131        <td class="help">
132          <span id="nofFormSets.message" class="message"></span>
133          Number of form sets to generate.
134        </td>
135      </tr>
136      </table>
137      <div id="step2message"></div>
138    </div>
139  </div>
141  <div class="step" id="step-3">
142    <div class="step-no">3</div>
143    <div class="step-title">Referral form download</div>
144    <div class="step-content">
146      <table class="step-form">
147      </table>
148      <div id="step3message"></div>
149    </div>
150  </div>
152  <div id="wizard-status"></div>
153  <div id="wizard-progress"></div>
155  <div id="not-found" style="display: none;" class="bg-filled-100 fullborder"></div>
157  <table class="navigation" id="navigation">
158  <tr>
159    <td><base:button id="gocancel" title="Cancel" /></td>
160    <td><base:button id="gonext" title="Next" image="<%=home+"/images/gonext.png"%>" /></td>
161    <td><base:button id="gorestart" title="Restart" image="<%=home+"/images/goback.png"%>" /></td>
162    <td><base:button id="downloadformbatch1" title="Download form batch file 1" image="<%=home+"/images/download.png"%>" /></td>
163    <td><base:button id="downloadformbatch2" title="Download form batch file 2" image="<%=home+"/images/download.png"%>" /></td>
164    <td><base:button id="updateusedscanbidlist" title="Update used SCAN-B ID list" image="<%=home+"/images/gonext.png"%>" /></td>
165    <td id="gonext-message" class="message"></td>
166  </tr>
167  </table>
169  </form>
170  </div>
178  if (dc != null) dc.close();
Note: See TracBrowser for help on using the repository browser.