[open-ils-commits] r14503 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/server/circ (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Oct 20 00:11:01 EDT 2009
Author: phasefx
Date: 2009-10-20 00:10:58 -0400 (Tue, 20 Oct 2009)
New Revision: 14503
Modified:
trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
trunk/Open-ILS/xul/staff_client/server/circ/checkout.js
trunk/Open-ILS/xul/staff_client/server/circ/checkout_overlay.xul
Log:
experiment: duedate/duetime picker during checkout. Not sure when/how the middle layer ignores the time component of a duedate to treat it as a calendar day. Also not sure if some folks would still prefer to have a Today + 3 days, etc. convenience menu
Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2009-10-20 02:36:11 UTC (rev 14502)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd 2009-10-20 04:10:58 UTC (rev 14503)
@@ -1824,8 +1824,8 @@
<!ENTITY staff.circ.renew_overlay.renew_export.label "Export">
<!ENTITY staff.circ.renew_overlay.trim_list.label "Trim List (20 rows)">
<!ENTITY staff.circ.renew_overlay.strict_barcode.label "Strict Barcode">
-<!ENTITY staff.circ.checkout_overlay.duedate_menu.label "Normal">
-<!ENTITY staff.circ.checkout_overlay.duedate_menu.accesskey "u">
+<!ENTITY staff.circ.checkout_overlay.duedate.label "Specific Due Date">
+<!ENTITY staff.circ.checkout_overlay.duedate.accesskey "u">
<!ENTITY staff.circ.checkout_overlay.barcode.accesskey "C">
<!ENTITY staff.circ.checkout_overlay.export.accesskey "">
<!ENTITY staff.circ.checkout_overlay.export.label "Export">
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkout.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkout.js 2009-10-20 02:36:11 UTC (rev 14502)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkout.js 2009-10-20 04:10:58 UTC (rev 14503)
@@ -114,21 +114,17 @@
}
}
],
- 'checkout_duedate_menu' : [
+ 'checkout_duedate_datepicker' : [
['change'],
function(ev) {
try {
- obj.check_date(ev.target);
- ev.target.parentNode.setAttribute('style','');
+ if (obj.check_date(ev.target)) {
+ ev.target.parentNode.setAttribute('style','');
+ } else {
+ ev.target.parentNode.setAttribute('style','background-color: red');
+ }
} catch(E) {
- ev.target.parentNode.setAttribute('style','background-color: red');
- alert(E + '\n' + document.getElementById('circStrings').getString('staff.circ.checkout.date.exception'));
- try {
- ev.target.inputField.select();
- ev.target.inputField.focus();
- } catch(EX) { /* this should work, let me try on other platforms */
- obj.error.sdump('D_ERROR','menulist.inputField: ' + EX);
- }
+ alert('Error in checkout.js, checkout_duedate_datepicker @change: ' + E);
}
}
],
@@ -333,24 +329,18 @@
},
'check_date' : function(node) {
+ var obj = this;
JSAN.use('util.date');
try {
- if (node.value == 'Normal') { return true; }
- var pattern = node.value.match(/Today \+ (\d+) days/);
- if (pattern) {
- var today = new Date();
- var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*pattern[1] );
- node.value = util.date.formatted_date(todayPlus,"%F");
- }
- if (! util.date.check('YYYY-MM-DD',node.value) ) {
- throw(document.getElementById('circStrings').getString('staff.circ.invalid_date'));
- }
+ obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','false');
+ obj.controller.view.checkout_barcode_entry_textbox.disabled = false;
+ obj.controller.view.cmd_checkout_submit.setAttribute('disabled','false');
+ obj.controller.view.cmd_checkout_submit.disabled = false;
if (util.date.check_past('YYYY-MM-DD',node.value) ) {
- throw(document.getElementById('circStrings').getString('staff.circ.checkout.date.too_early.error'));
+ obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','true');
+ obj.controller.view.cmd_checkout_submit.setAttribute('disabled','true');
+ return false;
}
- if ( util.date.formatted_date(new Date(),'%F') == node.value) {
- throw(document.getElementById('circStrings').getString('staff.circ.checkout.date.too_early.error'));
- }
return true;
} catch(E) {
throw(E);
@@ -568,11 +558,20 @@
'checkout' : function(params) {
var obj = this;
- try { obj.check_date(obj.controller.view.checkout_duedate_menu); } catch(E) { return; }
- if (obj.controller.view.checkout_duedate_menu.value != 'Normal') {
- params.due_date = obj.controller.view.checkout_duedate_menu.value;
- }
+ if (document.getElementById('checkout_duedate_checkbox').checked) {
+ if (! obj.check_date(obj.controller.view.checkout_duedate_datepicker)) return;
+ var tp = document.getElementById('checkout_duedate_timepicker');
+ var dp = obj.controller.view.checkout_duedate_datepicker;
+ var tp_date = tp.dateValue;
+ var dp_date = dp.dateValue;
+ tp_date.setFullYear( dp_date.getFullYear() );
+ tp_date.setMonth( dp_date.getMonth() );
+ tp_date.setDate( dp_date.getDate() );
+ JSAN.use('util.date');
+ params.due_date = util.date.formatted_date(tp_date,'%{iso8601}');
+ }
+
if (typeof obj.on_checkout == 'function') { obj.on_checkout(params); }
if (! (params.barcode||params.noncat)) { return; }
Modified: trunk/Open-ILS/xul/staff_client/server/circ/checkout_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/checkout_overlay.xul 2009-10-20 02:36:11 UTC (rev 14502)
+++ trunk/Open-ILS/xul/staff_client/server/circ/checkout_overlay.xul 2009-10-20 04:10:58 UTC (rev 14503)
@@ -39,16 +39,9 @@
accesskey="&staff.patron_display.checkout.submit.accesskey;"/>
<spacer flex="1"/>
<hbox id="duedate_hbox">
- <label value="&staff.circ.checkout_overlay.duedate_menu.label;" accesskey="&staff.circ.checkout_overlay.duedate_menu.accesskey;" control="checkout_duedate_menu"/>
- <menulist id="checkout_duedate_menu" editable="true">
- <menupopup>
- <menuitem label="&common.date_helper.normal;" selected="true"/>
- <menuitem label="&common.date_helper.3_days;" />
- <menuitem label="&common.date_helper.7_days;" />
- <menuitem label="&common.date_helper.14_days;" />
- <menuitem label="&common.date_helper.30_days;" />
- </menupopup>
- </menulist>
+ <checkbox id="checkout_duedate_checkbox" label="&staff.circ.checkout_overlay.duedate.label;" accesskey="&staff.circ.checkout_overlay.duedate.accesskey;" oncommand="if (this.checked) { this.nextSibling.focus(); } else { document.getElementById('checkout_barcode_entry_textbox').focus(); }"/>
+ <datepicker id="checkout_duedate_datepicker" type="popup" />
+ <timepicker id="checkout_duedate_timepicker" type="popup" />
</hbox>
</hbox>
More information about the open-ils-commits
mailing list