diff --git a/changelog.txt b/changelog.txt index 0832f8b..ff8d311 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ +version 1.2 + - cssClass attribute for CalEvents + - multiple event sources (using an array for the 'events' option) + - the 'events' option for fullCalendar() and gcalFullCalendar() is now optional + version 1.1 (5/10/09) - Added the following options: - weekStart diff --git a/fullcalendar.js b/fullcalendar.js index e3c17c6..e61c63b 100644 --- a/fullcalendar.js +++ b/fullcalendar.js @@ -47,13 +47,32 @@ var tdTopBug, trTopBug, tbodyTopBug, sniffBugs = true; + + var eventSources; + var eo = options.events; + if (eo) { + if (typeof eo == 'string' || $.isFunction(eo)) { + eventSources = [eo]; + }else{ + var item = eo[0]; + if (item) { + if (typeof item == 'string' || $.isFunction(item)) + eventSources = eo; + else { + eventSources = [eo]; + } + } + } + } + else eventSources = []; + + this.each(function() { var date = options.year ? new Date(options.year, options.month || 0, 1) : new Date(); var start, end, today, numWeeks; - var events = typeof options.events != 'string' && !$.isFunction(options.events) ? - cleanEvents(options.events) : null; var ignoreResizes = false; + var events; function updateMonth() { clearEvents(); @@ -80,12 +99,41 @@ updateMonth(); } + /*function updateEvent(event) { + } + + function removeEvent(event) { + var eventId = typeof event == 'object' ? event.id : event; + var newEvents = []; + for (var i=0; i" + (roundE ? "" : '') + ""); buildEventText(event, element.find('td.c')); + if (event.cssClass) element.addClass(event.cssClass); if (options.eventRender) { var res = options.eventRender(event, element); if (typeof res != 'undefined') { @@ -746,8 +801,7 @@ // string utilities function zeroPad(n) { - if (n < 10) return '0' + n; - return n; + return (n < 10 ? '0' : '') + n; } @@ -764,6 +818,10 @@ return events; } + function segSort(a, b) { + return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start); + } + // date utils @@ -832,13 +890,12 @@ $.ISO8601String = function(date) { // derived from http://delete.me.uk/2005/03/iso8601.html - var zeropad = function (num) { return ((num < 10) ? '0' : '') + num; } return date.getUTCFullYear() + - "-" + zeropad(date.getUTCMonth() + 1) + - "-" + zeropad(date.getUTCDate()) + - "T" + zeropad(date.getUTCHours()) + - ":" + zeropad(date.getUTCMinutes()) + - ":" + zeropad(date.getUTCSeconds()) + + "-" + zeroPad(date.getUTCMonth() + 1) + + "-" + zeroPad(date.getUTCDate()) + + "T" + zeroPad(date.getUTCHours()) + + ":" + zeroPad(date.getUTCMinutes()) + + ":" + zeroPad(date.getUTCSeconds()) + "Z"; }; diff --git a/gcal.js b/gcal.js index 4b676b5..75bc9aa 100644 --- a/gcal.js +++ b/gcal.js @@ -27,7 +27,7 @@ if (options && typeof options.events == 'string') { feedURL = options.events; } - else return this; + else return this.fullCalendar(options); feedURL = feedURL.replace(/\/basic$/, '/full');