How to extend the year drop-down menu of jscalendar

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to extend the year drop-down menu of jscalendar

Ines Göhlert
Hello everybody,

is it possible to change the number of entries in the year drop-down  
menu of jscalendar? I'd like to extend it to 20 entries (default: 12)

I found the following lines in calendar.js and changed line 301 to i  
= 20, but then the drop-down menu didn't show up anymore. I changed  
the value back to 12, voilá, the drop-down menu fully worked again.  
It's possible to enter a value lesser than 12, but not greater than  
that.

=================
Calendar.showYearsCombo = function (fwd) {
var cal = Calendar._C;
if (!cal) {
return false;
}
var cal = cal;
var cd = cal.activeDiv;
var yc = cal.yearsCombo;
if (cal.hilitedYear) {
Calendar.removeClass(cal.hilitedYear, "hilite");
}
if (cal.activeYear) {
Calendar.removeClass(cal.activeYear, "active");
}
cal.activeYear = null;
var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
var yr = yc.firstChild;
var show = false;
for (var i = 12; i > 0; --i) {
if (Y >= cal.minYear && Y <= cal.maxYear) {
yr.innerHTML = Y;
yr.year = Y;
yr.style.display = "block";
show = true;
} else {
yr.style.display = "none";
}
yr = yr.nextSibling;
Y += fwd ? cal.yearStep : -cal.yearStep;
}
if (show) {
var s = yc.style;
s.display = "block";
if (cd.navtype < 0)
s.left = cd.offsetLeft + "px";
else {
var ycw = yc.offsetWidth;
if (typeof ycw == "undefined")
// Konqueror brain-dead techniques
ycw = 50;
s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
}
s.top = (cd.offsetTop + cd.offsetHeight) + "px";
}
};

=================

I'm not very familiar with JavaScript, so I would be very grateful  
for a plain solution.

THX
Ines




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: How to extend the year drop-down menu of jscalendar

Alessandro  Vernet
Administrator
Hi Ines,

I don't have a full solution for you, but have you tried to see if the
number 12 appears in other places? If it doesn't, are you getting a
JavaScript error when you change it to 20, or it just "doesn't work"?

Alex

On 4/7/06, Ines Göhlert <[hidden email]> wrote:

> Hello everybody,
>
> is it possible to change the number of entries in the year drop-down
> menu of jscalendar? I'd like to extend it to 20 entries (default: 12)
>
> I found the following lines in calendar.js and changed line 301 to i
> = 20, but then the drop-down menu didn't show up anymore. I changed
> the value back to 12, voilá, the drop-down menu fully worked again.
> It's possible to enter a value lesser than 12, but not greater than
> that.
>
> =================
> Calendar.showYearsCombo = function (fwd) {
> var cal = Calendar._C;
> if (!cal) {
> return false;
> }
> var cal = cal;
> var cd = cal.activeDiv;
> var yc = cal.yearsCombo;
> if (cal.hilitedYear) {
> Calendar.removeClass(cal.hilitedYear, "hilite");
> }
> if (cal.activeYear) {
> Calendar.removeClass(cal.activeYear, "active");
> }
> cal.activeYear = null;
> var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
> var yr = yc.firstChild;
> var show = false;
> for (var i = 12; i > 0; --i) {
> if (Y >= cal.minYear && Y <= cal.maxYear) {
> yr.innerHTML = Y;
> yr.year = Y;
> yr.style.display = "block";
> show = true;
> } else {
> yr.style.display = "none";
> }
> yr = yr.nextSibling;
> Y += fwd ? cal.yearStep : -cal.yearStep;
> }
> if (show) {
> var s = yc.style;
> s.display = "block";
> if (cd.navtype < 0)
> s.left = cd.offsetLeft + "px";
> else {
> var ycw = yc.offsetWidth;
> if (typeof ycw == "undefined")
> // Konqueror brain-dead techniques
> ycw = 50;
> s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
> }
> s.top = (cd.offsetTop + cd.offsetHeight) + "px";
> }
> };
>
> =================
>
> I'm not very familiar with JavaScript, so I would be very grateful
> for a plain solution.
>
> THX
> Ines
>
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet