[open-ils-commits] r9175 - in trunk/Open-ILS/web/opac:
skin/default/js skin/default/xml/common theme/default/css
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Apr 1 11:01:14 EDT 2008
Author: erickson
Date: 2008-04-01 10:25:05 -0400 (Tue, 01 Apr 2008)
New Revision: 9175
Modified:
trunk/Open-ILS/web/opac/skin/default/js/holds.js
trunk/Open-ILS/web/opac/skin/default/js/myopac.js
trunk/Open-ILS/web/opac/skin/default/xml/common/holds.xml
trunk/Open-ILS/web/opac/theme/default/css/colors.css
Log:
added style to indicate a hold thaw date is either invalid or <= today
Modified: trunk/Open-ILS/web/opac/skin/default/js/holds.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/holds.js 2008-04-01 14:24:23 UTC (rev 9174)
+++ trunk/Open-ILS/web/opac/skin/default/js/holds.js 2008-04-01 14:25:05 UTC (rev 9175)
@@ -27,6 +27,9 @@
};
}
+$('holds_frozen_thaw_input').onkeyup =
+ function(){holdsVerifyThawDateUI('holds_frozen_thaw_input');}
+
function _holdsHandleStaffMe() {
holdArgs.recipient = G.user;
holdsDrawEditor();
@@ -707,10 +710,15 @@
hold.frozen('t');
unHideMe($('hold_frozen_thaw_row'));
thawDate = $('holds_frozen_thaw_input').value;
- if(thawDate)
- hold.thaw_date(thawDate);
- else
+ if(thawDate) {
+ if(holdsVerifyThawDate(thawDate)) {
+ hold.thaw_date(thawDate);
+ } else {
+ /* XXX */
+ }
+ } else {
hold.thaw_date(null);
+ }
}
//check for alternate hold formats
@@ -815,3 +823,31 @@
}
+/* verify that the thaw date is valid and after today */
+function holdsVerifyThawDate(thawDate) {
+ thawDate = Date.parseIso8601(thawDate);
+ if(thawDate) {
+ var today = new Date();
+ today = new Date(today.getFullYear(), today.getMonth(), today.getDate())
+ if(thawDate > today)
+ return thawDate.iso8601Format('YMD', false, false, true);
+ }
+ return null;
+}
+
+
+function holdsVerifyThawDateUI(element) {
+ value = $(element).value;
+
+ if(!value) {
+ removeCSSClass($(element), 'invalid_field');
+ return;
+ }
+
+ if(!holdsVerifyThawDate(value)) {
+ addCSSClass($(element), 'invalid_field');
+ } else {
+ removeCSSClass($(element), 'invalid_field');
+ }
+}
+
Modified: trunk/Open-ILS/web/opac/skin/default/js/myopac.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/myopac.js 2008-04-01 14:24:23 UTC (rev 9174)
+++ trunk/Open-ILS/web/opac/skin/default/js/myopac.js 2008-04-01 14:25:05 UTC (rev 9175)
@@ -19,6 +19,9 @@
function myOPACInit() {
if(!(G.user && G.user.session)) initLogin();
else myOPACChangePage( "summary" );
+
+ $('myopac_holds_thaw_date_input').onkeyup =
+ function(){holdsVerifyThawDateUI('myopac_holds_thaw_date_input'); }
}
function myopacReload() {
@@ -1438,8 +1441,8 @@
function myopacApplyThawDate() {
var dateString = $('myopac_holds_thaw_date_input').value;
if(dateString) {
- dateString = (dateString == null) ? null :
- Date.parseIso8601(dateString).iso8601Format('YMDHM', false, false, true);
+ dateString = holdsVerifyThawDate(dateString);
+ if(!dateString) return;
} else {
dateString = null;
}
Modified: trunk/Open-ILS/web/opac/skin/default/xml/common/holds.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/common/holds.xml 2008-04-01 14:24:23 UTC (rev 9174)
+++ trunk/Open-ILS/web/opac/skin/default/xml/common/holds.xml 2008-04-01 14:25:05 UTC (rev 9175)
@@ -3,6 +3,7 @@
<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/jscalendar/calendar.js'></script>
<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/jscalendar/lang/calendar-en.js'></script>
<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_JS_BASE"-->/jscalendar/calendar-setup.js'></script>
+<script language='javascript' type='text/javascript' src='<!--#echo var="OILS_OPAC_JS_HOST"-->/common/js/DP_DateExtensions.js'></script>
<div>
<div id='xulholds_box' class='hide_me canvas' style='margin-top: 6px;'>
Modified: trunk/Open-ILS/web/opac/theme/default/css/colors.css
===================================================================
--- trunk/Open-ILS/web/opac/theme/default/css/colors.css 2008-04-01 14:24:23 UTC (rev 9174)
+++ trunk/Open-ILS/web/opac/theme/default/css/colors.css 2008-04-01 14:25:05 UTC (rev 9175)
@@ -94,3 +94,5 @@
.check_mark { color: green; }
#myopac_holds_thaw_date_form { border: 1px solid #E0E0E0; }
+
+.invalid_field { border: 3px solid red; }
More information about the open-ils-commits
mailing list