ctx.page_title = l("Get a Library Card");
# for privacy, reload the page after (default) 5 minutes
+return_to = CGI.param('return-to');
+no_wrapper = CGI.param('no-wrapper');
refresh_time = ctx.register.settings.refresh_timeout || 300;
-ctx.refresh = refresh_time _ '; ' _ 'https://www.kcls.org';
+complete_url = return_to || 'https://www.kcls.org'
+ctx.refresh = refresh_time _ '; ' _ complete_url;
+
+# Ugh, CGI.new/.param insists on mangling the return-to URL.
+# Build the redo_url by hand.
+redo_url = '/eg/opac/register';
+IF return_to;
+ redo_url = redo_url _ '?return-to=' _ return_to;
+ SET redo_url = redo_url _ '&no-wrapper=1' IF no_wrapper;
+ELSIF no_wrapper;
+ redo_url = redo_url _ '?no-wrapper=1';
+END;
# some useful variables and MACROs for display,
# field validation, and added info display
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript"
src="[% ctx.media_prefix %]/js/ui/default/opac/register.js"></script>
+ <script>
+ var timeout_redirect = '[% complete_url | html %]';
+ </script>
<style>
/* Keep the CSS here for now for simplicity.
[% IF ctx.register.success %]
<h2>[% l('Registration successful!') %]<h3>
- <a href='/eg/opac/register'><button
+ <a href='[% redo_url | html %]'><button
id='submit-another'>Submit Another Application</button></a>
<br/>
<br/>
<div class='success-minus-2'>
You will be automatically redirected to
- <a href="https://www.kcls.org">www.kcls.org</a>...
+ <a href="[% complete_url | html %]">[% complete_url | html %]</a>...
</div>
<hr/>
<input type='hidden' id='register-success' value='yep'/>
[% ELSE %]
<form method='POST' onsubmit="return onsub()">
+ <input type="hidden" name="return-to" value="[% return_to %]"/>
+ <input type="hidden" name="no-wrapper" value="[% no_wrapper %]"/>
<ul>
<li>
<label>Choose a card size....</label>
<input type="submit" value="[% l('Submit Registration') %]"/>
</div>
<div class="grid-cell">
- <button onclick="location.href='https://www.kcls.org/'; return false">
+ <button onclick="location.href='[% complete_url | html %]'; return false">
Cancel and Return to KCLS
</button>
</div>
var last_activity = new Date();
var activity_timeout = 300000; // 300 seconds
var post_success_timeout = 30000; // 15 seconds
-var timeout_redirect = 'https://www.kcls.org';
var phone_regex = new RegExp(/^\d{3}-\d{3}-\d{4}/);
var post_regex = new RegExp(/^\d{5}(?:[-\s]\d{4})?$/);
+// Loaded from the template to pick up return-to URL option.
+// var timeout_redirect = 'https://www.kcls.org';
+
/* show/hide card options depending on the selected type. */
function show_card_types(type) {
last_activity = new Date();