1
Venezia
Fix for: js calendar - first popup showing start date from setrange()
  • 2004/5/13 2:47

  • Venezia

  • Just popping in

  • Posts: 36

  • Since: 2003/6/24


At present the js Calendar used by XoopsFormTextDateSelect and XoopsFormDateTime pops up the first time showing the date for January 2000. Subsequent popups show the correct date.

FIX:

Filename: /include/calendarjs.php
Function: function showCalendar(id)

Suggested Code:

function showCalendar(id) {
var el = xoopsGetElementById(id);
if (calendar != null) {
calendar.hide();
} else {
var cal = new Calendar(true, , selected, closeHandler);
calendar = cal;
cal.setRange(2000, 2015);
calendar.create();
}
calendar.sel = el;
calendar.parseDate(el.value);
calendar.showAtElement(el);
Calendar.addEvent(document, "mousedown", checkCalendar);
return false;
}

Explanation:
The only change is to move the parseDate() call to after the calendar has been set to point to the function's element id parameter.

The calendar's selected date is then set correctly whether the calendar is being created for first time or not.


Venezia

2
Herko
Re: Fix for: js calendar - first popup showing start date from setrange()
  • 2004/5/13 6:41

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Great, thanks. Can you submit this patch to the sourceforge.net XOOPS project tracker, so the core devs can look at it and add it to the core? Thanks!

Herko

3
Venezia
Re: Fix for: js calendar - first popup showing start date from setrange()
  • 2004/5/13 7:05

  • Venezia

  • Just popping in

  • Posts: 36

  • Since: 2003/6/24


Herko,

Should fixes such as these be posted directly to the XOOPS project tracker, or should they be posted here first? Or does it matter?

Venezia

4
Herko
Re: Fix for: js calendar - first popup showing start date from setrange()
  • 2004/5/13 7:15

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


that depends on what you want. If you post them here, people can fix it for themselves, if you post them on the tracker, they will be included in a next release. Posting them on both places is the best, I think. If you link to the tracker item in your posts here, poeple can monitor its status too.

herko

5
Mithrandir
Re: Fix for: js calendar - first popup showing start date from setrange()

Great, thanks.

This bug has ... erhm... bugged me for a long time, but my JavaScript skills are below zero.

I'll see to it that this one and your xoopstree bugfix are put in XOOPS 2.0.7

Login

Who's Online

264 user(s) are online (176 user(s) are browsing Support Forums)


Members: 0


Guests: 264


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits