 |
CalendarXP.net Support Most forums here are private and invisible to public.
|
View previous topic :: View next topic |
Author |
Message |
colnrita
Joined: 26 Sep 2007 Posts: 8 Location: Darkest SW Australia
|
Posted: Thu Sep 27, 2007 3:07 am Post subject: Giving Equal Prominence to Events and Holidays |
|
|
In my application I find that many of the Events I want to feature, occur on Public Holidays which are programmed in the Agenda. As a viewer's interest in an event probably depends on whether it is a Holiday or not, is there a way of showing the Holiday and the Event as separate boxes in the same calendar cell?
|
|
Back to top |
|
 |
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Thu Sep 27, 2007 5:08 am Post subject: |
|
|
Yes, please take a look at the agenda.js file of the MockupSiblingDemo in your package. You should find the following code in the fHoliday() function:
Code: | if (m==1&&d==1)
r=[" Jan 1, "+y+" \n Happy New Year! ", "alert('Happy New Year!')", null, null, "Holiday.jpg", false, "<div align=left class='MsgBoard'>Happy New Year!</div>"]; |
If you want to add more events to the New Year's day, simply use the fAppendEvent() calls, not the fAddEven(), to append more boxes to the same date.
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
 |
colnrita
Joined: 26 Sep 2007 Posts: 8 Location: Darkest SW Australia
|
Posted: Fri Sep 28, 2007 11:25 am Post subject: |
|
|
Thanks for rapid response!
Yep, had a look at your example - the New Year's holiday is "hard wired" in the fHoliday function and comes up with a starfish and a cheery message (both in the box and as a tooltip). No problem so far. When I append another Event for New Years Day to the list of three fAppendEvent calls above the fHoliday function in Agenda.js, that works fine but the starfish and the holiday messages disappear - how do you get BOTH?
|
|
Back to top |
|
 |
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Fri Sep 28, 2007 2:51 pm Post subject: |
|
|
[UPDATED]Take a look at the bottom of the fHoliday() function in your agenda.js, and you shall find:
Code: | return rE?rE:r; // favor events over holidays |
change it to the following will give you both:
Code: | if (rE&&r) {r[7]=(r[7]?r[7]:"")+rE[7]; return r}
else return rE?rE:r; |
[UPDATED]The above code is incorrect, the index should be 6 not 7:
Code: | if (rE&&r) {r[6]=(r[6]?r[6]:"")+rE[6]; return r}
else return rE?rE:r; |
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Last edited by calendarxp on Sun Sep 30, 2007 5:26 pm; edited 1 time in total |
|
Back to top |
|
 |
colnrita
Joined: 26 Sep 2007 Posts: 8 Location: Darkest SW Australia
|
Posted: Sun Sep 30, 2007 2:57 pm Post subject: |
|
|
Thanks - A bit of tweaking of this code and that provided in your response to "How to merge daily events with holiday events" (way down in this Forum) got it all to work more or less as intended. One problem though; the calendar rarely loads a "Holiday" and an "Event" on the same day without needing a click of the mouse somewhere in the calendar; if the page is refreshed, it works though. Is this a timing issue?
I'm working on how to get two "Holiday" events to show separately if they fall on the same date (eg something that always happens on the 10th of the month may coincide with something that always happens on the second Tuesday).
It would be great if these options could be toggled by setting a true/false variable somewhere. javascript:emoticon(' ')
Idea
|
|
Back to top |
|
 |
calendarxp Site Admin
Joined: 30 Jan 2005 Posts: 409
|
Posted: Sun Sep 30, 2007 5:23 pm Post subject: |
|
|
1st, there is a bug in the previous code, the array index should be 6 instead of 7.
Code: | if (rE&&r) {r[6]=(r[6]?r[6]:"")+rE[6]; return r}
else return rE?rE:r; |
2nd, if you had 2 overlapping holidays, the best way to handle is to separate them in the fHoliday() and do a merge check before return. It'd be very similar to the (rE&&r) check above, which determines the overlapping between event and holiday. e.g.
Code: | if (m==1&&d==1)
r=[" Jan 1, "+y+" \n Happy New Year! ", "", "#4682b4", "white", null, false, sNewYear];
else
... these are the holiday checkes for "r" group
// now use a separate check for "r2" group
var r2=null;
if (new Date(y, m-1,d).getDay()==2) // Tuesdays
r2=["Tuesdays","", "gold", "red", null, false, "<span>Tuesdays</span>"];
if (r&&r2) {
// now merge the holiday attributes because the current date has both
r[6]+=r2[6];
r[0]+=r2[0];
// we only merge messages and html and keep all other attributes as in "r".
return r;
} |
_________________ Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
Copyright 2003- Idemfactor Solutions, Inc. All rights reserved.
Powered by phpBB © 2001, 2005 phpBB Group
|