- eventsmanager_src.zip
- css
- en-us
- fr-ca
- Gadget.xml
- icon.png
- images
- AddEvent.gif
- anim
- 1.gif
- 2.gif
- 2.pdn
- 3.gif
- 4.gif
- 5.gif
- 6.gif
- 7.gif
- bgEvents.jpg
- BgImage.jpg
- BgSettings.jpg
- Binder.gif
- bmp
- AddEvent.bmp
- BgImage.bmp
- BgSettings.bmp
- CloseIconCold.bmp
- CloseIconHot.bmp
- EventListBgImage.bmp
- Footer.bmp
- grayDot.bmp
- Header.bmp
- Search.bmp
- SearchIcon.bmp
- SliderBgImage.bmp
- cal.gif
- CloseIconCold.jpg
- CloseIconHot.jpg
- ErrorBgImage.jpg
- EventListBgImage.gif
- Footer.jpg
- grayDot.gif
- Header.jpg
- HotEvent.gif
- Search.jpg
- SearchIcon.jpg
- SliderBgImage.gif
- SliderCold.png
- SliderHot.png
- js
- sound
- toutoune.wav
- deploygadget_demo.zip
- DeployGadget.exe
- ICSharpCode.SharpZipLib.dll
- deploygadget_src.zip
- eventsmanager_demo.zip
- MyGadget.gadget
|
// JScript File
// Called by Init (Document.js)
// Start a timer to check for upcoming events
function NotificationTimer()
{
var searchText = document.getElementById("SearchTextBox").value;
if(searchText == "" || searchText == null) LoadEvents();
else Search(searchText);
setTimeout(NotificationTimer, RefreshInterval * 60 * 1000);
}
// Called by AddLineToEventsList (EventManager.js)
function CheckEvent(eventId)
{
var result = true;
var radical = "Event" + eventId;
var now = new Date();
var eventDate = System.Gadget.Settings.read(radical + "EventDate");
var notifyBefore = System.Gadget.Settings.read(radical + "NotifyBefore");
var eventDateInMs = getDateFromFormat(eventDate, "M/d/yyyy H:m");
var difference = eventDateInMs - now.getTime();
// the event is too old, and should be deleted
if(DeleteOldEvents==true && difference < -(OldEventDeletionDelay * 24 * 60 * 60 * 1000))
{
RemoveEvent(eventId);
result = false;
}
// the event is old
else if(difference <= 0)
{
System.Gadget.Settings.write(radical + "State", "Old");
}
// the event is coming soon (notify user/send email)
else if(difference < (notifyBefore * 60 * 60 * 1000))
{
if(System.Gadget.Settings.read(radical + "SendEmail") == true &&
System.Gadget.Settings.read(radical + "EmailSent") == false)
{
if(SendMail(eventId))
{
System.Gadget.Settings.write(radical + "EmailSent", true);
}
}
System.Gadget.Settings.write(radical + "State", "Hot");
}
else
{
System.Gadget.Settings.write(radical + "State", "Cold");
}
return result;
}
function SendMail(eventId)
{
var radical = "Event" + eventId;
var result = true;
// create an XmlHttpRequest obj
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
// ServerSideScript : script used to send mail
// method : POST
// async : false
xmlHttp.Open("POST",System.Gadget.Settings.read("ServerSideScript"),false);
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
// Email data
var email = System.Gadget.Settings.read("YourEmail");
var name = System.Gadget.Settings.read(radical + "Name");
var description = System.Gadget.Settings.read(radical + "Description");
var date = System.Gadget.Settings.read(radical + "EventDate");
var message = "You have an upcoming event : " + name + ".\nDate : " + date + "\nDescription :\n" + description + "\n\nSent by Event Manager Gadget.";
// if user specified an email adress
if(email != "")
{
// send the request
xmlHttp.send("address="+email+"&subject=notification : "+name+"&message="+message);
if(xmlHttp.status != 200)
{
// if request failed
result = false;
}
}
else
{
result = false;
}
return result;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.