CalendarXP.net Support Forum Index CalendarXP.net Support
Most forums here are private and invisible to public.
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I reset the system defined "today" to a date specified in the server end?

 
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> CalendarXP F.A.Q.
View previous topic :: View next topic  
Author Message
calendarxp
Site Admin


Joined: 30 Jan 2005
Posts: 409

PostPosted: Tue Feb 15, 2005 6:36 pm    Post subject: How can I reset the system defined "today" to a date specified in the server end? Reply with quote

The calendar engine uses 2 system objects gd and gToday to control the date of today. You may override them in the plugins.js file with any date you like, you can even rename it to plugins.asp to take advantage of ASP generated date.

1st, you need to prepend the following lines of code to the top of plugins.js file.
Code:
gd=new Date(2003,3-1,11); // You may use any date you want.
gToday=[gd.getFullYear(),gd.getMonth()+1,gd.getDate()];
gCurMonth=eval(gTheme[0]); // re-init the gCurMonth in case it using gToday.

2nd, you need to search through the theme-name.js file, e.g. normal.js, for any references to gToday, and copy them to the plugins.js file and put them behind the above gCurMonth definition so that they can be re-initialized. e.g.
Code:
gd=new Date(2003,3-1,11); // You may use any date you want.
gToday=[gd.getFullYear(),gd.getMonth()+1,gd.getDate()];
gCurMonth=eval(gTheme[0]); // re-init the gCurMonth in case it using gToday.

gsBottom="..."; // re-init gsBottom if it contains reference to gToday. (optional)
gdSelect=gToday; // re-init gdSelect if it references to gToday. (optional)

Finally, you may want to rename the plugins file to plugins.asp and use a date generated from ASP variables to replace the static one:
Code:
gd=new Date(<%= year %>,<%= month %>-1,<%= day %>); // year, month, day are server-end variables
...


Remember to modify the name & id of the calendar iframe tag accordingly to reflect the above renaming - e.g. "gToday:normal:agenda.js::plugins.asp". You can also use path in the name & id, more details can be found in the HelloWorld tutorial.

Also note that all options in the theme-name.js can be reset and overwritten in this manner.

_________________
Copyright 2003-2011 Idemfactor Solutions, Inc. All rights reserved.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CalendarXP.net Support Forum Index -> CalendarXP F.A.Q. All times are GMT
Page 1 of 1

 
Jump to:  
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