Monday 19 December 2005 3:33:47 pm
Thanks Xavier for the tip!! I tried out the DHTML calendar you recommended and I've almost got it working. Here's what i did: 1) I copied the stylesheet to design/standard/stylsheets/popupcalendar/skins/aqua/theme.css 2) Copied the javascript files to /design/standard/javascript/popupcalendar/ 3) In /settings/override/design.ini.append.php I added:
[StylesheetSettings]
SiteCSS=packages/styles/t01/files/default/file/design/base/stylesheets/t1/site-colors.css
ClassesCSS=packages/styles/t01/files/default/file/design/base/stylesheets/t1/classes-colors.css CSSFileList[]=popupcalendar/skins/aqua/theme.css
[JavaScriptSettings]
# List of JavaScript files to include in pagelayout
JavaScriptList[]
JavaScriptList[]=popupcalendar/calendar.js
JavaScriptList[]=popupcalendar/lang/calendar-en.js JavaScriptList[]=popupcalendar/calendar-setup.js 4) I created an override template for the ezdate attribute. In the ezdate template override i added the following ids to each input, id="year", id="month", id="day". Then i pasted the following javascript for the calendar at the very end of the template file. I also wrapped the javascript in <literal></literal> tags:
{literal}
<script type="text/javascript">
Calendar.setup(
{
inputField : "year",
ifFormat : "%Y"
}
);
Calendar.setup(
{
inputField : "month",
ifFormat : "%m"
}
);Calendar.setup(
{
inputField : "day",
ifFormat : "%d"
}
);
</script> {/literal} RESULTS The good news is that clicking in each of the year, month and day input fields brings up the popup calendar. More good news is that it actually puts the appropriate year, month or day in the appropriate field. There are two problems i could use some help with (did I forget to mention that i don't know any javascript :-) : 1) you have to click in each field and select a date to fill all three fields. If anyone can help with the javascript to enable clicking in one of the fields and updating all three, that would be awesome. As a tip, the documentation for the jscalendar describes how to keep two fields one week apart depending on whether the first or second is updated. The code is:
function catcalc(cal) {
var date = cal.date;
var time = date.getTime()
// use the _other_ field
var field = document.getElementById("f_calcdate");
if (field == cal.params.inputField) {
field = document.getElementById("f_date_a");
time -= Date.WEEK; // substract one week
} else {
time += Date.WEEK; // add one week
}
var date2 = new Date(time);
field.value = date2.print("%Y-%m-%d %H:%M"); } Perhaps there's a hint in there! 2) The second problem is that the calendar comes up across the whole page instead of just a little calendar. must be something wrong in the css, or a css rule in the site css file is overriding the calendar css file. Any suggestions? So, all and all it's very close and a very cool little solution. The popup calendar is essential in my opinion. Any help finishing this off would be MUCH appreciated. Cheers, Fraser
|