[open-ils-commits] r14958 - in trunk/Open-ILS/web: css/skin/default js/dojo/openils/circ/nls js/ui/default/circ/selfcheck templates/default/circ/selfcheck (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 18 16:04:03 EST 2009
Author: erickson
Date: 2009-11-18 16:03:57 -0500 (Wed, 18 Nov 2009)
New Revision: 14958
Modified:
trunk/Open-ILS/web/css/skin/default/selfcheck.css
trunk/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js
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/holds_page.tt2
trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2
trunk/Open-ILS/web/templates/default/circ/selfcheck/summary.tt2
Log:
implemented holds list and navigation links
Modified: trunk/Open-ILS/web/css/skin/default/selfcheck.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/selfcheck.css 2009-11-18 21:02:42 UTC (rev 14957)
+++ trunk/Open-ILS/web/css/skin/default/selfcheck.css 2009-11-18 21:03:57 UTC (rev 14958)
@@ -41,19 +41,29 @@
border: none;
}
-#oils-selfck-circ-table {
+.oils-selfck-item-table {
width: 98%;
margin-top: 15px;
}
-#oils-selfck-circ-table td {
- text-align: center;
+.oils-selfck-item-table td {
+ text-align: left;
+ padding: 10px;
}
-#oils-selfck-circ-table thead {
+.oils-selfck-item-table thead {
font-weight: bold;
}
+.oils-selfck-item-table tbody tr {
+ border-bottom: 1px solid #888;
+}
+
+.oils-selfck-item-table tbody td {
+ padding:10px;
+}
+
+
#oils-selfck-content-div {
width: 70%;
position: float;
@@ -73,9 +83,14 @@
}
#oils-selfck-info-nav span {
+ padding-left: 10px;
padding-right: 10px;
}
+#oils-selfck-info-nav span.selected {
+ background-color: #e0e0e0;
+}
+
#oils-selfck-circ-info-div fieldset {
margin: 15px 10px 15px 10px;
padding: 8px;
@@ -91,11 +106,4 @@
padding: 3px;
}
-#oils-selfck-circ-tbody tr {
- border-bottom: 1px solid #888;
-}
-#oils-selfck-circ-tbody td {
- padding:10px;
-}
-
Modified: trunk/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js 2009-11-18 21:02:42 UTC (rev 14957)
+++ trunk/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js 2009-11-18 21:03:57 UTC (rev 14958)
@@ -3,6 +3,8 @@
'TOTAL_ITEMS_ACCOUNT' : "Total items on account: <b>${0}</b>.",
'HOLDS_READY_FOR_PICKUP' : "You have <b>${0}</b> item(s) ready for pickup.",
'TOTAL_HOLDS' : "You have <b>${0}</b> total holds.",
- 'TOTAL_FINES_ACCOUNT' : "Total fines on account: <b>$${0}</b>."
+ 'TOTAL_FINES_ACCOUNT' : "Total fines on account: <b>$${0}</b>.",
+ 'HOLD_STATUS_READY' : 'Ready for pickup',
+ 'HOLD_STATUS_WAITING' : '#${0} in line with ${1} copies'
}
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 21:02:42 UTC (rev 14957)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-11-18 21:03:57 UTC (rev 14958)
@@ -4,6 +4,7 @@
dojo.require('openils.Util');
dojo.require('openils.User');
dojo.require('openils.Event');
+dojo.require('openils.widget.ProgressDialog');
dojo.requireLocalization('openils.circ', 'selfcheck');
var localeStrings = dojo.i18n.getLocalization('openils.circ', 'selfcheck');
@@ -37,23 +38,26 @@
// 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()
- }
- };
+ if(this.mockCheckouts = this.cgi.param('mock-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');
+ 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');
+ }
}
@@ -68,20 +72,20 @@
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(); }
- );
+ // connect onclick handlers to the various navigation links
+ var linkHandlers = {
+ 'oils-selfck-hold-details-link' : function() { self.drawHoldsPage(); },
+ 'oils-selfck-nav-holds' : function() { self.drawHoldsPage(); },
+ 'oils-selfck-pay-fines-link' : function() { self.drawFinesPage(); },
+ 'oils-selfck-nav-fines' : function() { self.drawFinesPage(); },
+ 'oils-selfck-nav-home' : function() { self.drawCircPage(); },
+ 'oils-selfck-nav-logout' : function() { self.logoutPatron(); }
+ }
- dojo.connect(
- dojo.byId('oils-selfck-pay-fines-link'),
- 'onclick',
- function() { self.drawPayFinesPage(); }
- );
+ for(var id in linkHandlers)
+ dojo.connect(dojo.byId(id), 'onclick', linkHandlers[id]);
if(this.cgi.param('patron')) {
@@ -241,6 +245,8 @@
handler : function(barcode) { self.checkout(barcode); }
});
+ openils.Util.hide('oils-selfck-payment-page');
+ openils.Util.hide('oils-selfck-holds-page');
openils.Util.show('oils-selfck-circ-page');
this.circTbody = dojo.byId('oils-selfck-circ-tbody');
@@ -272,7 +278,7 @@
this.updateCircSummary();
// render mock checkouts for debugging?
- if(this.cgi.param('mock-circ')) {
+ if(this.mockCheckouts) {
for(var i in [1,2,3])
this.displayCheckout(this.mockCheckout);
}
@@ -355,11 +361,89 @@
openils.Util.hide('oils-selfck-circ-page');
openils.Util.hide('oils-selfck-payment-page');
openils.Util.show('oils-selfck-holds-page');
+
+ this.holdTbody = dojo.byId('oils-selfck-hold-tbody');
+ if(!this.holdTemplate)
+ this.holdTemplate = this.holdTbody.removeChild(dojo.byId('oils-selfck-hold-row'));
+ while(this.holdTbody.childNodes[0])
+ this.holdTbody.removeChild(this.holdTbody.childNodes[0]);
+
+ progressDialog.show(true);
+
+ var self = this;
+ fieldmapper.standardRequest( // fetch the hold IDs
+ ['open-ils.circ', 'open-ils.circ.holds.id_list.retrieve'],
+ { async : true,
+ params : [this.authtoken, this.patron.id()],
+
+ oncomplete : function(r) {
+ var ids = openils.Util.readResponse(r);
+ if(!ids || ids.length == 0) return;
+
+ fieldmapper.standardRequest( // fetch the hold objects with fleshed details
+ ['open-ils.circ', 'open-ils.circ.hold.details.batch.retrieve.atomic'],
+ { async : true,
+ params : [self.authtoken, ids],
+ oncomplete : function(rr) {
+ self.drawHolds(openils.Util.readResponse(rr));
+ }
+ }
+ );
+ }
+ }
+ );
}
+/**
+ * Fetch and add a single hold to the list of holds
+ */
+SelfCheckManager.prototype.drawHolds = function(holds) {
+ holds = holds.sort(
+ // sort available holds to the top of the list
+ // followed by queue position order
+ function(a, b) {
+ if(a.status == 4) return -1;
+ if(a.queue_position < b.queue_position) return -1;
+ return 1;
+ }
+ );
+ progressDialog.hide();
+ for(var i in holds) {
+
+ var data = holds[i];
+ var row = this.holdTemplate.cloneNode(true);
+
+ if(data.mvr.isbn()) {
+ this.byName(row, 'jacket').setAttribute('src', '/opac/extras/ac/jacket/small/' + data.mvr.isbn());
+ }
+
+ this.byName(row, 'title').innerHTML = data.mvr.title();
+ this.byName(row, 'author').innerHTML = data.mvr.author();
+
+ if(data.status == 4) {
+
+ // hold is ready for pickup
+ this.byName(row, 'status').innerHTML = localeStrings.HOLD_STATUS_READY;
+
+ } else {
+
+ // hold is still pending
+ this.byName(row, 'status').innerHTML =
+ dojo.string.substitute(
+ localeStrings.HOLD_STATUS_WAITING,
+ [data.queue_position, data.potential_copies]
+ );
+ }
+
+ this.holdTbody.appendChild(row);
+ }
+}
+
+
+
/**
* Check out a single item. If the item is already checked
* out to the patron, redirect to renew()
@@ -371,6 +455,13 @@
return;
}
+ if(this.mockCheckouts) {
+ // if we're in mock-checkout mode, just insert another
+ // fake circ into the table and get out of here.
+ this.displayCheckout(this.mockCheckout);
+ return;
+ }
+
// TODO see if it's a patron barcode
// TODO see if this item has already been checked out in this session
@@ -443,7 +534,8 @@
this.byName(row, 'due_date').innerHTML =
dojo.date.locale.format(date, {selector : 'date'});
- this.circTbody.appendChild(row);
+ // put new circs at the top of the list
+ this.circTbody.insertBefore(row, this.circTbody.getElementsByTagName('tr')[0]);
}
@@ -451,19 +543,22 @@
return dojo.query('[name=' + name+']', node)[0];
}
+
+SelfCheckManager.prototype.drawFinesPage = function() {
+
+ openils.Util.hide('oils-selfck-circ-page');
+ openils.Util.hide('oils-selfck-holds-page');
+ openils.Util.show('oils-selfck-payment-page');
+
+}
+
/**
* Print a receipt
*/
SelfCheckManager.prototype.printReceipt = function() {
}
-/**
- * Build the patron holds table
- */
-SelfCheckManager.prototype.displayHolds = function() {
-}
-
/**
* Logout the patron and return to the login page
*/
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 21:02:42 UTC (rev 14957)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/circ_page.tt2 2009-11-18 21:03:57 UTC (rev 14958)
@@ -1,5 +1,5 @@
<div id='oils-selfck-circ-table-div'>
- <table id='oils-selfck-circ-table'>
+ <table id='oils-selfck-circ-table' class='oils-selfck-item-table'>
<thead>
<tr>
<td id='oils-self-circ-pic-cell'></td>
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2 2009-11-18 21:02:42 UTC (rev 14957)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/holds_page.tt2 2009-11-18 21:03:57 UTC (rev 14958)
@@ -1,12 +1,11 @@
<div id='oils-selfck-hold-table-div'>
- <table id='oils-selfck-hold-table'>
+ <table id='oils-selfck-hold-table' class='oils-selfck-item-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'>
@@ -15,7 +14,6 @@
<td name='title'></td>
<td name='author'></td>
<td name='status'></td>
- <td name='type'></td>
</tr>
</tbody>
</table>
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 2009-11-18 21:02:42 UTC (rev 14957)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 2009-11-18 21:03:57 UTC (rev 14958)
@@ -31,7 +31,7 @@
[% INCLUDE 'default/circ/selfcheck/summary.tt2' %]
</div>
</div>
-
+<div dojoType='openils.widget.ProgressDialog' jsId='progressDialog'/>
[% END %]
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/summary.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/summary.tt2 2009-11-18 21:02:42 UTC (rev 14957)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/summary.tt2 2009-11-18 21:03:57 UTC (rev 14958)
@@ -1,7 +1,9 @@
<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>
+ <span><a id='oils-selfck-nav-home' href='javascript:void(0);' class='selected'>Home</a></span>
+ <span><a id='oils-selfck-nav-holds' href='javascript:void(0);'>My Holds</a></span>
+ <span><a id='oils-selfck-nav-fines' href='javascript:void(0);'>Pay Fines</a></span>
+ <span><a id='oils-selfck-nav-logout' href='javascript:void(0);'>Log Out</a></span>
</div>
<fieldset>
<legend>Items Checked Out</legend>
More information about the open-ils-commits
mailing list