[open-ils-commits] r10144 - in trunk/Open-ILS/web/opac: common/js
locale/en-US skin/default/js skin/default/xml
skin/default/xml/common skin/default/xml/myopac
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Jul 26 01:14:19 EDT 2008
Author: dbs
Date: 2008-07-26 01:14:11 -0400 (Sat, 26 Jul 2008)
New Revision: 10144
Modified:
trunk/Open-ILS/web/opac/common/js/DP_DateExtensions.js
trunk/Open-ILS/web/opac/locale/en-US/opac.dtd
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/body.xml
trunk/Open-ILS/web/opac/skin/default/xml/common/css_common.xml
trunk/Open-ILS/web/opac/skin/default/xml/common/holds.xml
trunk/Open-ILS/web/opac/skin/default/xml/common/js_common.xml
trunk/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml
Log:
Start replacing jscalendar and DP_DateExtensions with Dojo
* Use dijit.DateTextBox for date picker in setting "suspend hold until" dates
* Start using dojo.date.stamp.* and dojo.date.locale.* functions instead of DP_DateExtensions
* Here, we replace all occurrences of Date.parseIso8601()
* Remove ISO formatting hints as hold dates now use locales rather than being hardcoded
Modified: trunk/Open-ILS/web/opac/common/js/DP_DateExtensions.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/DP_DateExtensions.js 2008-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/common/js/DP_DateExtensions.js 2008-07-26 05:14:11 UTC (rev 10144)
@@ -21,6 +21,9 @@
CHANGES: --------------------------------------------------------------------------------
+ 2008-07-26 / dscott at laurentian.ca
+ - Comment out Date.parseIso8601 as we move to Dojo
+
2007-02-02 / billserickson at gmail.com
- chopped out some utility methods to trim file size
- changed some formatting for visual ease
@@ -29,7 +32,7 @@
comes accross 123456ms and not 123ms + 456 microseconds
*/
-
+/*
Date.parseIso8601 = function(CurDate) {
// Check the input parameters
@@ -91,7 +94,9 @@
};
+*/
+
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* "Date" Object Prototype Extensions */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Modified: trunk/Open-ILS/web/opac/locale/en-US/opac.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/opac.dtd 2008-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/locale/en-US/opac.dtd 2008-07-26 05:14:11 UTC (rev 10144)
@@ -222,7 +222,6 @@
<!ENTITY opac.holds.freeze "Suspend this hold">
<!ENTITY opac.holds.freeze.help "A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.">
<!ENTITY opac.holds.freeze.thaw_date "Automatically activate hold on:">
-<!ENTITY opac.holds.freeze.thaw_date.format "YYYY-MM-DD">
<!-- =================================================================
MyOPAC Preferences Page
Modified: trunk/Open-ILS/web/opac/skin/default/js/holds.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/holds.js 2008-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/skin/default/js/holds.js 2008-07-26 05:14:11 UTC (rev 10144)
@@ -142,13 +142,13 @@
frozenbox.checked = true;
unHideMe($('hold_frozen_thaw_row'));
if(hold.thaw_date()) {
- $('holds_frozen_thaw_input').value = hold.thaw_date();
+ dijit.byId('holds_frozen_thaw_input').setValue(hold.thaw_date());
} else {
- $('holds_frozen_thaw_input').value = '';
+ dijit.byId('holds_frozen_thaw_input').setValue('');
}
} else {
frozenbox.checked = false;
- $('holds_frozen_thaw_input').value = '';
+ dijit.byId('holds_frozen_thaw_input').setValue('');
hideMe($('hold_frozen_thaw_row'));
}
}
@@ -715,7 +715,7 @@
if($('holds_frozen_chkbox').checked) {
hold.frozen('t');
unHideMe($('hold_frozen_thaw_row'));
- thawDate = $('holds_frozen_thaw_input').value;
+ thawDate = dojo.date.stamp.toISOString(dijit.byId('holds_frozen_thaw_input').getValue());
if(thawDate) {
thawDate = holdsVerifyThawDate(thawDate);
if(thawDate)
@@ -831,25 +831,16 @@
runEvt('common', 'holdUpdated');
}
-
/* verify that the thaw date is valid and after today */
function holdsVerifyThawDate(dateString) {
- thawDate = Date.parseIso8601(dateString);
- if(thawDate && holdGreaterThanToday(dateString))
- return thawDate.iso8601Format('YMD', false, false, true);
+ thawDate = dojo.date.stamp.fromISOString(dateString);
+ if(thawDate && (dojo.date.compare(thawDate) > 0))
+ return dojo.date.stamp.toISOString(thawDate);
return null;
}
-function holdGreaterThanToday(dateString) {
- thawDate = Date.parseIso8601(dateString);
- var today = new Date();
- today = new Date(today.getFullYear(), today.getMonth(), today.getDate())
- return thawDate > today;
-}
-
-
function holdsVerifyThawDateUI(element) {
- value = $(element).value;
+ value = dojo.date.stamp.toISOString(dijit.byId(element).getValue());
if(!value) {
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-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/skin/default/js/myopac.js 2008-07-26 05:14:11 UTC (rev 10144)
@@ -348,8 +348,8 @@
hideMe($n(row, 'myopac_hold_unfrozen_true'))
unHideMe($n(row, 'myopac_hold_unfrozen_false'))
if(h.thaw_date()) {
- var d = Date.parseIso8601(h.thaw_date());
- $n(row, 'myopac_holds_frozen_until').appendChild(text(d.iso8601Format('YMD')));
+ var d = dojo.date.stamp.fromISOString(h.thaw_date());
+ $n(row, 'myopac_holds_frozen_until').appendChild(text(dojo.date.locale.format(d, {.selector: 'date', fullYear: true})));
}
} else {
unHideMe($n(row, 'myopac_hold_unfrozen_true'))
@@ -518,14 +518,14 @@
//function _trimTime(time) { if(!time) return ""; return time.replace(/\ .*/,""); }
function _trimTime(time) {
if(!time) return "";
- var d = Date.parseIso8601(time);
+ var d = dojo.date.stamp.fromISOString(time);
if(!d) return ""; /* date parse failed */
return d.iso8601Format('YMD');
}
function _trimSeconds(time) {
if(!time) return "";
- var d = Date.parseIso8601(time);
+ var d = dojo.date.stamp.fromISOString(time);
if(!d) return ""; /* date parse failed */
return d.iso8601Format('YMDHM',null,true,true);
}
@@ -761,7 +761,7 @@
fleshedUser = user;
if(!user) return;
- var expireDate = Date.parseIso8601(user.expire_date());
+ var expireDate = dojo.date.stamp.fromISOString(user.expire_date());
if( expireDate < new Date() ) {
appendClear($('myopac.expired.date'), expireDate.iso8601Format('YMD'));
unHideMe($('myopac.expired.alert'));
@@ -1192,7 +1192,7 @@
duration = parseInt(duration + '000');
var dtf = circ.circ_time();
- var start = Date.parseIso8601(circ.circ_time());
+ var start = dojo.date.stamp.fromISOString(circ.circ_time());
var due = new Date( start.getTime() + duration );
appendClear($n(row, 'circ_time'), text(due.iso8601Format('YMDHM', null, true, true)));
}
@@ -1431,17 +1431,10 @@
hideMe($('myopac_holds_main_table'));
unHideMe($('myopac_holds_thaw_date_form'));
$('myopac_holds_thaw_date_input').focus();
- Calendar.setup({
- inputField : "myopac_holds_thaw_date_input",
- ifFormat : "%Y-%m-%d",
- button : "myopac_holds_thaw_date_img",
- align : "Tl",
- singleClick : true
- });
}
function myopacApplyThawDate() {
- var dateString = $('myopac_holds_thaw_date_input').value;
+ var dateString = dojo.date.stamp.toISOString(dijit.byId('myopac_holds_thaw_date_input').getValue());
if(dateString) {
dateString = holdsVerifyThawDate(dateString);
if(!dateString) return;
Modified: trunk/Open-ILS/web/opac/skin/default/xml/body.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/body.xml 2008-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/skin/default/xml/body.xml 2008-07-26 05:14:11 UTC (rev 10144)
@@ -1,7 +1,7 @@
<!--
<body onload='init();' style='height: 100%; border: 2px solid black;'>
-->
-<body onload='init();'>
+<body class="tundra" onload='init();'>
<table width='100%'>
<tbody>
<tr>
Modified: trunk/Open-ILS/web/opac/skin/default/xml/common/css_common.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/common/css_common.xml 2008-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/skin/default/xml/common/css_common.xml 2008-07-26 05:14:11 UTC (rev 10144)
@@ -1,4 +1,3 @@
-
<!-- CSS shared across pages goes here -->
<link type='text/css' rel='stylesheet' href="<!--#echo var='OILS_SKIN_BASE'-->/default/css/layout.css"/>
@@ -17,3 +16,9 @@
rel='search' title="Evergreen"
href="http://<!--#echo var='SERVER_NAME'-->/opac/extras/opensearch/1.1/-/osd.xml" />
+<!-- enable Dojo date picker -->
+<style type="text/css">
+ @import '/js/dojo/dojo/resources/dojo.css';
+ @import '/js/dojo/dijit/themes/tundra/tundra.css';
+ @import '/js/dojo/dijit/themes/tundra/tundra_rtl.css';
+</style>
Modified: trunk/Open-ILS/web/opac/skin/default/xml/common/holds.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/common/holds.xml 2008-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/skin/default/xml/common/holds.xml 2008-07-26 05:14:11 UTC (rev 10144)
@@ -1,10 +1,4 @@
-<link rel="stylesheet" type="text/css"
- href='<!--#echo var="OILS_JS_BASE"-->/jscalendar/calendar-brown.css' title="win2k-cold-1" />
-<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;'>
<center>
@@ -147,26 +141,7 @@
&opac.holds.freeze.thaw_date;
</td>
<td class='holds_cell'>
- <input size='10' maxlength='10' id='holds_frozen_thaw_input' />
- <button style='padding: 0px;' id='holds_frozen_thaw_date_button'>
- <img src='<!--#echo var="OILS_JS_BASE"-->/jscalendar/img.gif'
- style="cursor: pointer; border: 1px solid red; padding: 0px; margin: -3px;"
- title="Date selector"
- onmouseover="this.style.background='red';"
- onmouseout="this.style.background=''" />
- </button>
- (&opac.holds.freeze.thaw_date.format;)
-
- <script language='javascript' type="text/javascript">
- Calendar.setup({
- inputField : "holds_frozen_thaw_input",
- ifFormat : "%Y-%m-%d",
- button : "holds_frozen_thaw_date_button",
- align : "Tl",
- singleClick : true
- });
- </script>
-
+ <input dojoType="dijit.form.DateTextBox" size='10' maxlength='10' id='holds_frozen_thaw_input' />
</td>
</tr>
@@ -248,5 +223,3 @@
<span id='holds_invalid_recipient' class='hide_me'>&common.hold.patron.invalid;</span>
</div>
-
-
Modified: trunk/Open-ILS/web/opac/skin/default/xml/common/js_common.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/common/js_common.xml 2008-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/skin/default/xml/common/js_common.xml 2008-07-26 05:14:11 UTC (rev 10144)
@@ -32,3 +32,23 @@
<!--#endif -->
</script>
+
+ <!-- enable Dojo date picker -->
+ <script language='javascript' type="text/javascript">
+ var djConfig = {parseOnLoad: true, isDebug: true},
+ locale,
+ lang,
+ bidi;
+
+ djConfig.locale = '<!--#echo var="locale"-->';
+ </script>
+
+ <script type="text/javascript" src='/js/dojo/dojo/dojo.js'></script>
+
+ <script language="javascript" type="text/javascript">
+ dojo.require("dijit._Calendar");
+ dojo.require("dijit.form.DateTextBox");
+ dojo.require("dojo.date.locale");
+ dojo.require("dojo.date.stamp");
+ dojo.require("dojo.parser");
+ </script>
Modified: trunk/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml 2008-07-26 01:44:01 UTC (rev 10143)
+++ trunk/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml 2008-07-26 05:14:11 UTC (rev 10144)
@@ -29,9 +29,7 @@
<div id='myopac_holds_thaw_date_form' class='hide_me'>
<div id='myopac_holds_freeze_select_thaw'>&myopac.holds.freeze.select_thaw;</div>
<p>
- <input type='text' id='myopac_holds_thaw_date_input'/>
- <img src="<!--#echo var='OILS_OPAC_JS_HOST'-->/common/js/jscalendar/img.gif" id='myopac_holds_thaw_date_img' class='cal_img'/>
- (&opac.holds.freeze.thaw_date.format;)
+ <input dojoType="dijit.form.DateTextBox" size='10' maxlength='10' type='text' id='myopac_holds_thaw_date_input' />
</p>
<p>
<button onclick='myopacApplyThawDate();'>&common.submit;</button>
More information about the open-ils-commits
mailing list