[open-ils-commits] r16950 - in trunk/Open-ILS/xul/staff_client: chrome/content/util server/locale/en-US server/patron (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jul 15 17:34:22 EDT 2010
Author: phasefx
Date: 2010-07-15 17:34:16 -0400 (Thu, 15 Jul 2010)
New Revision: 16950
Modified:
trunk/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js
trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
trunk/Open-ILS/xul/staff_client/server/patron/holds.js
Log:
more configuration options for date/timepicker dialog, and use that dialog with staff editing of hold thaw date and expire time
Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js 2010-07-15 21:34:09 UTC (rev 16949)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/timestamp.js 2010-07-15 21:34:16 UTC (rev 16950)
@@ -23,6 +23,17 @@
JSAN.use('util.date');
$('datepicker').value = xul_param('default_date',{'modal_xulG':true}) || util.date.formatted_date(new Date(),'%F');
+ if (xul_param('default_time',{'modal_xulG':true})) {
+ $('timepicker').value = xul_param('default_time',{'modal_xulG':true});
+ }
+ if (xul_param('time_readonly',{'modal_xulG':true})) {
+ $('timepicker').readonly = true; // This isn't working correctly with xulrunner 1.9.2
+ $('timepicker').disabled = true; // So, poor man's kludge
+ }
+ if (xul_param('date_readonly',{'modal_xulG':true})) {
+ $('datepicker').readonly = true; // This isn't working correctly with xulrunner 1.9.2
+ $('datepicker').disabled = true; // So, poor man's kludge
+ }
if (xul_param('title',{'modal_xulG':true})) { $('dialogheader').setAttribute('title',xul_param('title',{'modal_xulG':true})); }
if (xul_param('description',{'modal_xulG':true})) { $('dialogheader').setAttribute('description',xul_param('description',{'modal_xulG':true})); }
Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties 2010-07-15 21:34:09 UTC (rev 16949)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties 2010-07-15 21:34:16 UTC (rev 16950)
@@ -420,23 +420,19 @@
staff.circ.holds.activate.prompt.plural=Are you sure you would like to activate holds %1$s?
staff.circ.holds.suspend.prompt=Are you sure you would like to suspend hold %1$s?
staff.circ.holds.suspend.prompt.plural=Are you sure you would like to suspend holds %1$s?
-staff.circ.holds.activation_date.prompt=Please enter an Activation Date (or leave blank to unset) for hold %1$s. This will also Suspend the hold.
-staff.circ.holds.activation_date.prompt.plural=Please enter an Activation Date (or leave blank to unset) for holds %1$s. This will also Suspend the holds.
-staff.circ.holds.activation_date.too_early.error=Activation Date needs to be either unset or set to fall on a future date.
-staff.circ.holds.activation_date.invalid_date=Invalid Date
+staff.circ.holds.activation_date.prompt=Please enter an Activation Date (or choose Remove to unset) for hold %1$s. This will also Suspend the hold.
+staff.circ.holds.activation_date.prompt.plural=Please enter an Activation Date (or choose Remove to unset) for holds %1$s. This will also Suspend the holds.
+staff.circ.holds.activation_date.dialog.description=Activation Date
staff.circ.holds.request_date.prompt=Please enter a new Request Date for hold %1$s. WARNING: This effectively reorders the holds queue.
staff.circ.holds.request_date.prompt.plural=Please enter a new Request Date for holds %1$s. WARNING: This effectively reorders the holds queue.
staff.circ.holds.request_date.dialog.description=Request Date
-staff.circ.holds.request_date.invalid_date=Invalid Date
-staff.circ.holds.expire_time.prompt=Please enter an Expiration Date (or leave blank to unset) for hold %1$s.
-staff.circ.holds.expire_time.prompt.plural=Please enter an Expiration Date (or leave blank to unset) for holds %1$s.
-staff.circ.holds.expire_time.too_early.error=Expiration Date needs to be either unset or set to fall on a future date.
-staff.circ.holds.expire_time.invalid_date=Invalid Date
+staff.circ.holds.expire_time.prompt=Please enter an Expiration Date (or choose Remove to unset) for hold %1$s.
+staff.circ.holds.expire_time.prompt.plural=Please enter an Expiration Date (or choose Remove to unset) for holds %1$s.
+staff.circ.holds.expire_time.dialog.description=Expiration Date
staff.circ.holds.shelf_expire_time.prompt=Please enter a Shelf Expiration Date for hold %1$s.
staff.circ.holds.shelf_expire_time.prompt.plural=Please enter a Shelf Expiration Date for holds %1$s.
staff.circ.holds.shelf_expire_time.dialog.description=Shelf Expire Time
-staff.circ.holds.shelf_expire_time.invalid_date=Invalid Date
staff.circ.holds.modifying_holds=Modifying Holds
staff.circ.holds.modifying_holds.yes=Yes
Modified: trunk/Open-ILS/xul/staff_client/server/patron/holds.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/holds.js 2010-07-15 21:34:09 UTC (rev 16949)
+++ trunk/Open-ILS/xul/staff_client/server/patron/holds.js 2010-07-15 21:34:16 UTC (rev 16950)
@@ -756,39 +756,32 @@
['command'],
function() {
try {
- JSAN.use('util.date');
- function check_date(value) {
- try {
- if (! util.date.check('YYYY-MM-DD',value) ) { throw(document.getElementById('circStrings').getString('staff.circ.holds.activation_date.invalid_date')); }
- if (util.date.check_past('YYYY-MM-DD',value) || util.date.formatted_date(new Date(),'%F') == value ) {
- throw(document.getElementById('circStrings').getString('staff.circ.holds.activation_date.too_early.error'));
- }
- return true;
- } catch(E) {
- alert(E);
- return false;
- }
- }
-
var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;});
var msg_singular = document.getElementById('circStrings').getFormattedString('staff.circ.holds.activation_date.prompt',[hold_list.join(', ')]);
var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.activation_date.prompt.plural',[hold_list.join(', ')]);
var msg = obj.retrieve_ids.length > 1 ? msg_plural : msg_singular;
- var value = 'YYYY-MM-DD';
var title = document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds');
- var thaw_date; var invalid = true;
- while(invalid) {
- thaw_date = window.prompt(msg,value,title);
- if (thaw_date) {
- invalid = ! check_date(thaw_date);
- } else {
- invalid = false;
+ var desc = document.getElementById('circStrings').getString('staff.circ.holds.activation_date.dialog.description');
+
+ JSAN.use('util.window'); var win = new util.window();
+ var my_xulG = win.open(
+ urls.XUL_TIMESTAMP_DIALOG, 'edit_thaw_date', 'chrome,resizable,modal',
+ {
+ 'title' : title,
+ 'description' : desc,
+ 'msg' : msg,
+ 'allow_unset' : true,
+ 'disallow_future_dates' : false,
+ 'disallow_past_dates' : true,
+ 'disallow_today' : true,
+ 'default_time' : '00:00:00',
+ 'time_readonly' : false
}
- }
- if (thaw_date || thaw_date == '') {
+ );
+ if (my_xulG.complete) {
circ.util.batch_hold_update(
hold_list,
- { 'frozen' : 't', 'thaw_date' : thaw_date == '' ? null : util.date.formatted_date(thaw_date,'%{iso8601}') },
+ { 'frozen' : 't', 'thaw_date' : my_xulG.timestamp },
{ 'progressmeter' : progressmeter, 'oncomplete' : function() { obj.clear_and_retrieve(true); } }
);
}
@@ -801,39 +794,33 @@
['command'],
function() {
try {
- JSAN.use('util.date');
- function check_date(value) {
- try {
- if (! util.date.check('YYYY-MM-DD',value) ) { throw(document.getElementById('circStrings').getString('staff.circ.holds.expire_time.invalid_date')); }
- if (util.date.check_past('YYYY-MM-DD',value) || util.date.formatted_date(new Date(),'%F') == value ) {
- throw(document.getElementById('circStrings').getString('staff.circ.holds.expire_time.too_early.error'));
- }
- return true;
- } catch(E) {
- alert(E);
- return false;
- }
- }
-
var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;});
var msg_singular = document.getElementById('circStrings').getFormattedString('staff.circ.holds.expire_time.prompt',[hold_list.join(', ')]);
var msg_plural = document.getElementById('circStrings').getFormattedString('staff.circ.holds.expire_time.prompt.plural',[hold_list.join(', ')]);
var msg = obj.retrieve_ids.length > 1 ? msg_plural : msg_singular;
var value = 'YYYY-MM-DD';
var title = document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds');
- var expire_time; var invalid = true;
- while(invalid) {
- expire_time = window.prompt(msg,value,title);
- if (expire_time) {
- invalid = ! check_date(expire_time);
- } else {
- invalid = false;
+ var desc = document.getElementById('circStrings').getString('staff.circ.holds.expire_time.dialog.description');
+
+ JSAN.use('util.window'); var win = new util.window();
+ var my_xulG = win.open(
+ urls.XUL_TIMESTAMP_DIALOG, 'edit_expire_time', 'chrome,resizable,modal',
+ {
+ 'title' : title,
+ 'description' : desc,
+ 'msg' : msg,
+ 'allow_unset' : true,
+ 'disallow_future_dates' : false,
+ 'disallow_past_dates' : true,
+ 'disallow_today' : true,
+ 'default_time' : '00:00:00',
+ 'time_readonly' : false
}
- }
- if (expire_time || expire_time == '') {
+ );
+ if (my_xulG.complete) {
circ.util.batch_hold_update(
hold_list,
- { 'expire_time' : expire_time == '' ? null : util.date.formatted_date(expire_time,'%{iso8601}') },
+ { 'expire_time' : my_xulG.timestamp },
{ 'progressmeter' : progressmeter, 'oncomplete' : function() { obj.clear_and_retrieve(true); } }
);
}
More information about the open-ils-commits
mailing list