[open-ils-commits] r14947 - in trunk/Open-ILS/web: css/skin/default js/ui/default/circ/selfcheck templates/default/circ/selfcheck (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Nov 17 23:44:50 EST 2009
Author: erickson
Date: 2009-11-17 23:44:48 -0500 (Tue, 17 Nov 2009)
New Revision: 14947
Added:
trunk/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2
trunk/Open-ILS/web/templates/default/circ/selfcheck/summary.tt2
Modified:
trunk/Open-ILS/web/css/skin/default/selfcheck.css
trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
trunk/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2
trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2
Log:
make circ info fetching synchronous to prevent race condition with scanning, added dummy data for testing, plugged in more stub functions, some css and layout fixes
Modified: trunk/Open-ILS/web/css/skin/default/selfcheck.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/selfcheck.css 2009-11-18 01:39:16 UTC (rev 14946)
+++ trunk/Open-ILS/web/css/skin/default/selfcheck.css 2009-11-18 04:44:48 UTC (rev 14947)
@@ -1,9 +1,12 @@
+body {
+ font-family: Arial, Verdana;
+ font-size: 14px;
+}
+
#oils-selfck-top-div {
- width: 99%;
- padding: 10px;
- margin: 0px;
- height: 180px;
+ padding: 20px;
+ margin: 2px;
border: 1px solid #888;
text-align: center;
font-weight:bold;
@@ -24,7 +27,7 @@
}
#oils-selfck-bottom-div {
- width: 100%;
+ width: 98%;
padding: 10px;
}
@@ -39,28 +42,43 @@
}
#oils-selfck-circ-table {
- width: 100%;
+ width: 98%;
+ margin-top: 15px;
}
+#oils-selfck-circ-table td {
+ text-align: center;
+}
+
#oils-selfck-circ-table thead {
font-weight: bold;
}
-#oils-selfck-circ-table-div {
+#oils-selfck-content-div {
width: 70%;
position: float;
float: left;
- border-right: 1px solid #888;
}
-#oils-selfck-circ-info-div {
+#oils-selfck-summary-div {
width: 28%;
float: right;
+ border-left: 1px solid #888;
}
+#oils-selfck-info-nav {
+ margin: 15px 10px 15px 10px;
+ padding: 8px;
+ border-bottom: 1px dashed #888;
+}
+
+#oils-selfck-info-nav span {
+ padding-right: 10px;
+}
+
#oils-selfck-circ-info-div fieldset {
- margin: 20px;
- padding: 10px;
+ margin: 15px 10px 15px 10px;
+ padding: 8px;
border: 2px dashed #888;
-moz-border-radius: 3px;
}
@@ -69,13 +87,15 @@
font-weight: bold;
}
+#oils-selfck-circ-info-div div {
+ padding: 3px;
+}
+#oils-selfck-circ-tbody tr {
+ border-bottom: 1px solid #888;
+}
-/*
-#oils-selfck-main-table {width: 100%}
-#oils-selfck-main-table td {
- padding: 5px;
- border: 1px solid #888;
+#oils-selfck-circ-tbody td {
+ padding:10px;
}
-#oils-selfck-main-table- td {
-*/
+
Modified: trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-11-18 01:39:16 UTC (rev 14946)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-11-18 04:44:48 UTC (rev 14947)
@@ -1,3 +1,5 @@
+dojo.require('dojo.date.locale');
+dojo.require('dojo.date.stamp');
dojo.require('openils.CGI');
dojo.require('openils.Util');
dojo.require('openils.User');
@@ -34,8 +36,28 @@
// dict of org unit settings for "here"
this.orgSettings = {};
+
+
+ // Construct a mock checkout for debugging purposes
+ this.mockCheckout = {
+ payload : {
+ record : new fieldmapper.mvr(),
+ copy : new fieldmapper.acp(),
+ circ : new fieldmapper.circ()
+ }
+ };
+
+ this.mockCheckout.payload.record.title('Jazz improvisation for guitar');
+ this.mockCheckout.payload.record.author('Wise, Les');
+ this.mockCheckout.payload.record.isbn('0634033565');
+ this.mockCheckout.payload.copy.barcode('123456789');
+ this.mockCheckout.payload.circ.renewal_remaining(1);
+ this.mockCheckout.payload.circ.parent_circ(1);
+ this.mockCheckout.payload.circ.due_date('2012-12-21');
}
+
+
/**
* Fetch the org-unit settings, initialize the display, etc.
*/
@@ -46,9 +68,28 @@
this.authtoken = openils.User.authtoken;
this.loadOrgSettings();
+ // add onclick handlers for nav links
+
+ var self = this;
+ dojo.connect(
+ dojo.byId('oils-selfck-hold-details-link'),
+ 'onclick',
+ function() { self.drawHoldsPage(); }
+ );
+
+ dojo.connect(
+ dojo.byId('oils-selfck-pay-fines-link'),
+ 'onclick',
+ function() { self.drawPayFinesPage(); }
+ );
+
+
if(this.cgi.param('patron')) {
- // Patron barcode via cgi param. Mainly used for debugging.
+
+ // Patron barcode via cgi param. Mainly used for debugging and
+ // only works if password is not required by policy
this.loginPatron(this.cgi.param('patron'));
+
} else {
this.drawLoginPage();
}
@@ -224,106 +265,101 @@
}
);
+ // holds summary
+ this.updateHoldsSummary();
+
// items out summary
+ this.updateCircSummary();
- this.updateHoldsSummary();
- this.updateCircSummary();
+ // render mock checkouts for debugging?
+ if(this.cgi.param('mock-circ')) {
+ for(var i in [1,2,3])
+ this.displayCheckout(this.mockCheckout);
+ }
}
SelfCheckManager.prototype.updateHoldsSummary = function(decrement) {
+ if(!this.holdsSummary) {
+ var summary = fieldmapper.standardRequest(
+ ['open-ils.circ', 'open-ils.circ.holds.user_summary'],
+ {params : [this.authtoken, this.patron.id()]}
+ );
- var self = this;
- var oncomplete = function() {
- dojo.byId('oils-selfck-holds-total').innerHTML =
- dojo.string.substitute(
- localeStrings.TOTAL_HOLDS,
- [self.holdsSummary.total]
- );
+ this.holdsSummary = {};
+ this.holdsSummary.ready = Number(summary['4']);
+ this.holdsSummary.total = 0;
- dojo.byId('oils-selfck-holds-ready').innerHTML =
- dojo.string.substitute(
- localeStrings.HOLDS_READY_FOR_PICKUP,
- [self.holdsSummary.ready]
- );
- };
+ for(var i in summary)
+ this.holdsSummary.total += Number(summary[i]);
+ }
- if(!this.holdsSummary) {
- fieldmapper.standardRequest(
- ['open-ils.circ', 'open-ils.circ.holds.user_summary'],
- { async : true,
- params : [this.authtoken, this.patron.id()],
- oncomplete : function(r) {
- var summary = openils.Util.readResponse(r);
- self.holdsSummary = {};
- self.holdsSummary.ready = Number(summary['4']);
- self.holdsSummary.total = 0;
- for(var i in summary)
- self.holdsSummary.total += Number(summary[i]);
- oncomplete();
- }
- }
+ if(this.decrement)
+ this.holdsSummary.ready -= 1;
+
+ dojo.byId('oils-selfck-holds-total').innerHTML =
+ dojo.string.substitute(
+ localeStrings.TOTAL_HOLDS,
+ [this.holdsSummary.total]
);
- } else {
- if(this.decrement)
- this.holdsSummary.ready -= 1;
-
- oncomplete();
- }
+ dojo.byId('oils-selfck-holds-ready').innerHTML =
+ dojo.string.substitute(
+ localeStrings.HOLDS_READY_FOR_PICKUP,
+ [this.holdsSummary.ready]
+ );
}
SelfCheckManager.prototype.updateCircSummary = function(increment) {
- var self = this;
- var oncomplete = function() {
- dojo.byId('oils-selfck-circ-account-total').innerHTML =
- dojo.string.substitute(
- localeStrings.TOTAL_ITEMS_ACCOUNT,
- [self.circSummary.total]
- );
+ if(!this.circSummary) {
- dojo.byId('oils-selfck-circ-session-total').innerHTML =
- dojo.string.substitute(
- localeStrings.TOTAL_ITEMS_SESSION,
- [self.circSummary.session]
- );
+ var summary = fieldmapper.standardRequest(
+ ['open-ils.actor', 'open-ils.actor.user.checked_out.count'],
+ {params : [this.authtoken, this.patron.id()]}
+ );
+
+ this.circSummary = {
+ total : Number(summary.out) + Number(summary.overdue),
+ overdue : Number(summary.overdue),
+ session : 0
+ };
}
- if(this.circSummary) {
+ if(increment) {
+ // local checkout occurred. Add to the total and the session.
+ this.circSummary.total += 1;
+ this.circSummary.session += 1;
+ }
- if(increment) {
- // local checkout occurred. Add to the total and the session.
- this.circSummary.total += 1;
- this.circSummary.session += 1;
- }
+ dojo.byId('oils-selfck-circ-account-total').innerHTML =
+ dojo.string.substitute(
+ localeStrings.TOTAL_ITEMS_ACCOUNT,
+ [this.circSummary.total]
+ );
- oncomplete();
-
- } else {
- // fetch the circ summary for the patron
- var summary = fieldmapper.standardRequest(
- ['open-ils.actor', 'open-ils.actor.user.checked_out.count'],
- {
- async : true,
- params : [this.authtoken, this.patron.id()],
- oncomplete : function(r) {
- var summary = openils.Util.readResponse(r);
- self.circSummary = {
- total : Number(summary.out) + Number(summary.overdue),
- overdue : Number(summary.overdue),
- session : 0
- }
- oncomplete();
- }
- }
+ dojo.byId('oils-selfck-circ-session-total').innerHTML =
+ dojo.string.substitute(
+ localeStrings.TOTAL_ITEMS_SESSION,
+ [this.circSummary.session]
);
- }
}
+SelfCheckManager.prototype.drawHoldsPage = function() {
+ // TODO add option to hid scanBox
+ // this.updateScanBox(...)
+
+ openils.Util.hide('oils-selfck-circ-page');
+ openils.Util.hide('oils-selfck-payment-page');
+ openils.Util.show('oils-selfck-holds-page');
+}
+
+
+
+
/**
* Check out a single item. If the item is already checked
* out to the patron, redirect to renew()
@@ -394,16 +430,19 @@
var circ = evt.payload.circ;
var row = this.circTemplate.cloneNode(true);
- /*
if(record.isbn()) {
- var pic = $n(template, 'jacket');
- pic.setAttribute('src', '/opac/ac/jacket/small/' + cleanISBN(record.isbn()));
+ this.byName(row, 'jacket').setAttribute('src', '/opac/extras/ac/jacket/small/' + record.isbn());
}
- */
this.byName(row, 'barcode').innerHTML = copy.barcode();
this.byName(row, 'title').innerHTML = record.title();
this.byName(row, 'author').innerHTML = record.author();
+ this.byName(row, 'remaining').innerHTML = circ.renewal_remaining();
+
+ var date = dojo.date.stamp.fromISOString(circ.due_date());
+ this.byName(row, 'due_date').innerHTML =
+ dojo.date.locale.format(date, {selector : 'date'});
+
this.circTbody.appendChild(row);
}
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2 2009-11-18 01:39:16 UTC (rev 14946)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2 2009-11-18 04:44:48 UTC (rev 14947)
@@ -27,23 +27,3 @@
</tbody>
</table>
</div>
-
-<div id='oils-selfck-circ-info-div'>
- <fieldset>
- <legend>Items Checked Out</legend>
- <div id='oils-selfck-circ-session-total'></div>
- <div id='oils-selfck-circ-account-total'></div>
- </fieldset>
- <fieldset>
- <legend>Holds</legend>
- <div id='oils-selfck-holds-ready'></div>
- <div id='oils-selfck-holds-total'></div>
- <div><a href=='javascript:void(0);' id='oils-selfck-hold-details-link'>Hold Details</a></div>
- </fieldset>
- <fieldset>
- <legend>Fines</legend>
- <div id='oils-selfck-fines-total'></div>
- <div><a href='javascript:void(0);' id='oils-selfck-pay-fines-link'>Pay fines</a></div>
- </fieldset>
-</div>
-
Added: trunk/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2 (rev 0)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2 2009-11-18 04:44:48 UTC (rev 14947)
@@ -0,0 +1,22 @@
+<div id='oils-selfck-hold-table-div'>
+ <table id='oils-selfck-hold-table'>
+ <thead>
+ <tr>
+ <td id='oils-self-hold-pic-cell'></td>
+ <td>Title</td>
+ <td>Author</td>
+ <td>Status</td>
+ <td>Type</td>
+ </tr>
+ </thead>
+ <tbody id='oils-selfck-hold-tbody'>
+ <tr id='oils-selfck-hold-row'>
+ <td><img class='oils-selfck-jacket' name='jacket'></img></td>
+ <td name='title'></td>
+ <td name='author'></td>
+ <td name='status'></td>
+ <td name='type'></td>
+ </tr>
+ </tbody>
+ </table>
+</div>
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 2009-11-18 01:39:16 UTC (rev 14946)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 2009-11-18 04:44:48 UTC (rev 14947)
@@ -14,16 +14,22 @@
</div>
</div>
<div id='oils-selfck-bottom-div'>
- <div id='oils-selfck-circ-page' class='hidden'>
- <!-- Checkout / renewal interface -->
- [% INCLUDE 'default/circ/selfcheck/circ_page.tt2' %]
+ <div id='oils-selfck-content-div'>
+ <div id='oils-selfck-circ-page' class='hidden'>
+ <!-- Checkout / renewal interface -->
+ [% INCLUDE 'default/circ/selfcheck/circ_page.tt2' %]
+ </div>
+ <div id='oils-selfck-holds-page' class='hidden'>
+ <!-- Patron holds interface -->
+ [% INCLUDE 'default/circ/selfcheck/holds_page.tt2' %]
+ </div>
+ <div id='oils-selfck-payment-page' class='hidden'>
+ <!-- Credit Card payments interface -->
+ </div>
</div>
- <div id='oils-selfck-holds-page' class='hidden'>
- <!-- Patron holds interface -->
+ <div id='oils-selfck-summary-div'>
+ [% INCLUDE 'default/circ/selfcheck/summary.tt2' %]
</div>
- <div id='oils-selfck-payment-page' class='hidden'>
- <!-- Credit Card payments interface -->
- </div>
</div>
[% END %]
Added: trunk/Open-ILS/web/templates/default/circ/selfcheck/summary.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/summary.tt2 (rev 0)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/summary.tt2 2009-11-18 04:44:48 UTC (rev 14947)
@@ -0,0 +1,23 @@
+<div id='oils-selfck-circ-info-div'>
+ <div id='oils-selfck-info-nav'>
+ <span><a href='javascript:void(0);'>Home</a></span>
+ <span><a href='javascript:void(0);'>Done</a></span>
+ </div>
+ <fieldset>
+ <legend>Items Checked Out</legend>
+ <div id='oils-selfck-circ-session-total'></div>
+ <div id='oils-selfck-circ-account-total'></div>
+ </fieldset>
+ <fieldset>
+ <legend>Holds</legend>
+ <div id='oils-selfck-holds-ready'></div>
+ <div id='oils-selfck-holds-total'></div>
+ <div><a href='javascript:void(0);' id='oils-selfck-hold-details-link'>Hold Details</a></div>
+ </fieldset>
+ <fieldset>
+ <legend>Fines</legend>
+ <div id='oils-selfck-fines-total'></div>
+ <div><a href='javascript:void(0);' id='oils-selfck-pay-fines-link'>Pay fines</a></div>
+ </fieldset>
+</div>
+
More information about the open-ils-commits
mailing list