» Table Of Contents
Standard Events
Section 3.2.0
You add standard events to the calendar using the scevent.js file. A standard event is and event that occurs on a specific date. You simply want that event to appear in the calendar on that day.
The primary way of adding events is using the scevent.js file. This file is
nothing more that a list of calls to a function of the Scriptcalendar engine. The function is the "fscEvent" function. To create an event in the calendar, you simply make a call the fscEvent function. In order to call the function, you must know what parameters to use. Please see the table of the parameters below.
parameter |
type |
required |
description |
month |
number |
no |
The numeric month (1-12) of the date of the event. |
day |
number |
yes |
The numeric day (1-31) of the date of the event. |
year |
number |
no |
The 4 digit numeric year of the date of the event. |
text |
string |
no |
The text you want to appear in a date cell. It may include HTML. |
popuplink |
string |
no |
An url you want to popup in a new window when the event text is clicked. |
style |
string |
no |
A class name of a CSS class that you want applied to the event. |
tooltip |
string |
no |
A message that appears when the mouse hovers over an event. |
script |
string |
no |
Javascript to be executed during "onMouseDown" in the date cell. |
filter |
string |
no |
Keyword to allow users to filter events. |
To add a new event to the file, you first need to open it for editing. Windows notepad is an simple text editor and works well. You can use whatever editor you like.
Simply add a new call to the fscEvent function to the file. The call must be correct javascript code. For example, to a new event for January 1st 2010, add this code.
fscEvent( 1, 1, 2006, "January 1st 2010" );
You'll note that some of the parameters are missing. Since all the parameters after the EventText parameter were NULL, we just omitted them. This would be same as the call below.
fscEvent( 1, 1, 2006, "January 1st 2006", null, null, null, null, null );
To edit an event, locate it the file and change the fscEvent call as necessary.
To remove an event, locate it the file and delete the code for it.
When you are finished editing the scevent.js, you must upload it to your web server. Save the changes on your local machine, and then FTP it to the proper folder on your web server.
Again, the scevent.js file must be comprised of valid javascript code. It will cause a javacript error if the syntax is incorrect. There is an event editor tool described later on in this guide that will assist you constructing valid javascript.
Here is a example of an entire, short scevent.js file. It only has events in January 2010.
// ********* ********* ********* ********* ********* ********* ********* ********* *********
// Define Events
// call the fscEvent function
//
// # PARMS DATA TYPE DESCRIPTION
// 1 m number 2 digit month (1=jan, 2=feb, 3=mar,... 12=dec)
// 2 d number 2 digit day
// 3 y number 4 digit year
// 4 text string HTML event text
// 5 link string URL for popup window
// 6 style string CSS class for the event (in-line style is invalid)
// 7 tooltip string text for hover over tooltip
// 8 script string javascript to execute during onMouseDown
// 9 filter string keyword to allow users to filter events
// ********* ********* ********* ********* ********* ********* ********* ********* *********
fscEvent( 1, 19, 2010, "Custom color event example", null, "scEventRed", null, null );
fscEvent( 1, 20, 2010, "Custom color event example", null, "scEventOrange", null, null );
fscEvent( 1, 28, 2010, "multiple events", null, "scEventRed", null, null );
fscEvent( 1, 28, 2010, "multiple events", null, "scEventOrange", null, null );
fscEvent( 1, 28, 2010, "multiple events", null, "scEventYellow", null, null );
fscEvent( 1, 28, 2010, "multiple events", null, "scEventGreen", null, null );
fscEvent( 1, 28, 2010, "multiple events", null, "scEventBlue", null, null );
fscEvent( 1, 28, 2010, "multiple events", null, "scEventPurple", null, null );
» Table Of Contents