Edd
Posts: 547
|
| Posted: 02/02/2006, 9:20 PM |
|
I think that we would all agree that the CCS popup datepicker is looking "a bit tired".
I want to use the the Javascript Date Picker from http://www.dynarch.com/projects/calendar/
but get ticked off having to add my add code every time I want use a Date Picker.
Has anyone added this in as a component to CCS and would they share the code OR are CSS able to probide this as an optional extra - I will gladly pay for it.
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
dragoon
Posts: 173
|
| Posted: 02/03/2006, 10:21 AM |
|
i tried using the DHTML Calendar.
it seems to work, but the styles are overwriten by the CCS styles.

also i've tried loading dynamically the right language file...I have to dig a little more ...
if you're intersted, download the last release from sourceforge.net;
also, you may want to check the latest cvs release of calendar js (// $Id: calendar.js,v 1.52 2005/06/14 15:29:20 mishoo Exp $)
+and a little hack on line 158 of calendar-setup.js. Instead
if (dateEl) use if (dateEl.value) (if you want to set-up the default date)
|
 |
 |
dragoon
Posts: 173
|
| Posted: 02/03/2006, 10:31 AM |
|
I found a way so I can load different script files based on locale:
var _locale = "{res:CCS_LocaleID}";
function dhtmlLoadScript(url) {
var e = document.createElement("script");
e.src = url;
e.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(e);
}
function _load () {
if (_locale == "ro") {
dhtmlLoadScript("calendar/calendar-ro.js");
}
else if (_locale == "en") {
dhtmlLoadScript("calendar/calendar-en.js");
}
}
window.onload = _load;
of course don't forget the rest of the javascript files:
<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-system.css" title="system">
<script language="javascript" type="text/javascript" src="calendar/calendar.js"></script>
<script language="javascript" type="text/javascript" src="calendar/calendar-setup.js"></script>
more details about Dynamically Loading External JavaScript Files http://www.codehouse.com/javascript/articles/external/
|
 |
 |
dragoon
Posts: 173
|
| Posted: 02/03/2006, 10:35 AM |
|
and here is the script for initializing the calendar. also you must set the date format according to the locale.
<script language="JavaScript" type="text/javascript">
var _ifFormat;
if (_locale == "ro") {
_ifFormat = "%e/%m/%Y";
}
else if (_locale == "en") {
_ifFormat = "%m/%e/%Y";
}
var today = new Date();
Calendar.setup({
inputField: "expensesexpense_date",
ifFormat : _ifFormat,
align: "bR",
//range: [2005, 2006],
//singleClick: true,
firstDay: 1,
//date: "Thu Dec 1 00:00:00 UTC+0200 2005",
dateStatusFunc: function (date) {return ((date.getMonth() > today.getMonth() && date.getYear() >= today.getYear()) || (date.getDate() > today.getDate() && date.getMonth() == today.getMonth() && date.getYear() == today.getYear()) ) ? true : false; }
});
</script>
|
 |
 |
dragoon
Posts: 173
|
| Posted: 02/03/2006, 6:14 PM |
|
i have decided to give it one more shot.
1. removed from the css files everything that begines with .Calendar. (Style.css and Style_Components.css)
2. added the calendar image right after the input field
<img src="Styles/Sicomed/Images/DatePicker.gif" border="0" id="date_trigger">
you need to add an id that has to be specified in Calendar.setup:
Calendar.setup({
....
button: "date_trigger",
.....
3. made font-size: 14px; in the css of the new calendar on .calendar table class
here is the result:

this little hack went quite well; but it will be great if YES will add this Date Picker in their product. Or at least someone will write an add-on (I'll do it myselft - or at least I will try 'cause I never did it before; but right now I'm involved in multiple projects and I dont have the time ...)
|
 |
 |
Edd
Posts: 547
|
| Posted: 02/03/2006, 7:34 PM |
|
Thanks Dragoon
Will try it out
Peter R. how about "Yes Software" giving some light on how to make this a component, please? 
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
 |
 |
marcwolf
Posts: 361
|
| Posted: 02/08/2006, 4:13 PM |
|
Hi Folks
I have modified the CCS's date picker to handle times as well.
The details are in the Tips and Solutions pages
Enjoy
Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
|
 |
 |