[open-ils-commits] r15336 - trunk/Open-ILS/web/opac/skin/default/js (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jan 18 22:14:08 EST 2010
Author: dbs
Date: 2010-01-18 22:14:06 -0500 (Mon, 18 Jan 2010)
New Revision: 15336
Modified:
trunk/Open-ILS/web/opac/skin/default/js/copy_details.js
Log:
Give sites the ability to easily display due dates and times in the OPAC under "copy details"
We add two new variables to copy_details.js:
* showDueDate - this needs to be set to a non-false value to display the
due date in the OPAC
* showDueTime - this needs to be set to a non-false value to display the
due time in the OPAC, along with the due date. If showDueDate is false,
then the value of this variable is ignored.
Modified: trunk/Open-ILS/web/opac/skin/default/js/copy_details.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/copy_details.js 2010-01-19 02:07:45 UTC (rev 15335)
+++ trunk/Open-ILS/web/opac/skin/default/js/copy_details.js 2010-01-19 03:14:06 UTC (rev 15336)
@@ -2,8 +2,15 @@
var cpdCounter = 0;
var cpdNodes = {};
+/* showDueDate will show the due date in the OPAC */
+var showDueDate = false;
+/* showDueTime will show the due time (hours and minutes) in the OPAC;
+ if showDueDate is false, then showDueTime has no effect
+*/
+var showDueTime = false;
+
function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, copy_location ) {
-var i = cpdCheckExisting(contextRow);
+ var i = cpdCheckExisting(contextRow);
if(i) return i;
var counter = cpdCounter++;
@@ -25,6 +32,9 @@
unHideMe($n(templateRow, 'age_protect_label'));
unHideMe($n(templateRow, 'create_date_label'));
unHideMe($n(templateRow, 'holdable_label'));
+ }
+
+ if (isXUL() || showDueDate) {
unHideMe($n(templateRow, 'due_date_label'));
}
@@ -177,6 +187,9 @@
unHideMe($n(copyrow, 'age_protect_value'));
unHideMe($n(copyrow, 'create_date_value'));
unHideMe($n(copyrow, 'copy_holdable_td'));
+ }
+
+ if(isXUL() || showDueDate) {
unHideMe($n(copyrow, 'copy_due_date_td'));
}
@@ -236,15 +249,21 @@
} else {
$n(row, 'copy_is_holdable').appendChild(text(no));
}
+ }
+ if (isXUL() || showDueDate) {
var circ;
if( copy.circulations() ) {
circ = copy.circulations()[0];
if( circ ) {
- $n(row, 'copy_due_date').appendChild(text(circ.due_date().replace(/[T ].*/,'')));
+ var due_time = dojo.date.stamp.fromISOString(circ.due_date());
+ if( showDueTime ) {
+ $n(row, 'copy_due_date').appendChild(text(dojo.date.locale.format(due_time, {"formatLength": "medium"})));
+ } else {
+ $n(row, 'copy_due_date').appendChild(text(dojo.date.locale.format(due_time, {"selector": "date", "formatLength": "medium"})));
+ }
}
}
-
}
r.args.copy = copy;
More information about the open-ils-commits
mailing list