From 6a5be40d417de337c6c2171e09e04edc9cafea42 Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Mon, 21 Dec 2009 01:32:03 -0800 Subject: [PATCH] gcal timezone enhancement, cache option, DST parseDate bugfix, quickly adding/removing event source bugfix, destroy method, empty string parseDate bugfix --- docs/events-and-sources.txt | 10 ++-- docs/index.txt | 2 +- examples/json.html | 3 +- src/gcal.js | 8 ++- src/main.js | 51 +++++++++++++------ src/util.js | 65 ++++++++++++++++-------- tests/gcal.html | 4 +- tests/issue_206_parseDate_dst.html | 58 +++++++++++++++++++++ tests/issue_221_quick_remove_source.html | 63 +++++++++++++++++++++++ tests/issue_251_empty_end_date.html | 53 +++++++++++++++++++ tests/method_destroy.html | 46 +++++++++++++++++ 11 files changed, 316 insertions(+), 47 deletions(-) create mode 100644 tests/issue_206_parseDate_dst.html create mode 100644 tests/issue_221_quick_remove_source.html create mode 100644 tests/issue_251_empty_end_date.html create mode 100644 tests/method_destroy.html diff --git a/docs/events-and-sources.txt b/docs/events-and-sources.txt index af896fc..5df6448 100644 --- a/docs/events-and-sources.txt +++ b/docs/events-and-sources.txt @@ -29,13 +29,13 @@ The following options determine *how* events get on the calendar: start: start.getTime(), end: end.getTime() }, - function(result) { + function(events) { - // format the result into an array of CalEvents + // make sure the events are official CalEvent objects // (not seen here) - // then, pass the CalEvent array to the callback - callback(calevents); + // then, pass the events to the callback + callback(events); }); @@ -124,4 +124,4 @@ CalEvent: **source**: Array/String/Function (automatically populated) A reference to the original array, JSON URL, or function the event came from. Do not worry about populating this value, FullCalendar will - do this automatically. \ No newline at end of file + do this automatically. diff --git a/docs/index.txt b/docs/index.txt index 12efc4f..98484e2 100644 --- a/docs/index.txt +++ b/docs/index.txt @@ -116,7 +116,7 @@ Basic Options of the calendar. When hidden with ``false``, all-day events will not be displayed in agenda views. -**allDayText**: Boolean, *Default*: ``'all-day'`` +**allDayText**: String, *Default*: ``'all-day'`` In the agenda views, the text titling the "all-day" slot at the top of the calendar. **firstHour**: Integer, *Default*: 6 diff --git a/examples/json.html b/examples/json.html index de892ee..b5ecd6b 100644 --- a/examples/json.html +++ b/examples/json.html @@ -34,6 +34,7 @@ editable: true, events: "json-events.php", + cache: false, eventDrop: function(event, delta) { alert(event.title + ' was moved ' + delta + ' days\n' + @@ -77,4 +78,4 @@

json-events.php needs to be running in the same directory.

- \ No newline at end of file + diff --git a/src/gcal.js b/src/gcal.js index c1ee7c4..1f49b09 100644 --- a/src/gcal.js +++ b/src/gcal.js @@ -24,8 +24,9 @@ 'singleevents': true, 'max-results': 9999 }; - if (options.currentTimezone) { - params.ctz = options.currentTimezone.replace(' ', '_'); + var ctz = options.currentTimezone; + if (ctz) { + params.ctz = ctz = ctz.replace(' ', '_'); } $.getJSON(feedUrl + "?alt=json-in-script&callback=?", params, function(data) { var events = []; @@ -39,6 +40,9 @@ $.each(entry.link, function() { if (this.type == 'text/html') { url = this.href; + if (ctz) { + url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz; + } } }); if (allDay) { diff --git a/src/main.js b/src/main.js index 11aa144..69d80ec 100644 --- a/src/main.js +++ b/src/main.js @@ -28,7 +28,7 @@ var defaults = { // event ajax startParam: 'start', endParam: 'end', - cacheParam: '_', + cache: false, // time formats titleFormat: { @@ -147,9 +147,9 @@ $.fn.fullCalendar = function(options) { // element var _element = this, - element = $(this).addClass('fc'), + element = $(_element).addClass('fc'), elementWidth, - content = $("
").appendTo(this), // relative for ie6 + content = $("
").prependTo(_element), // relative for ie6 contentHeight; if (options.isRTL) { element.addClass('fc-rtl'); @@ -338,16 +338,17 @@ $.fn.fullCalendar = function(options) { var prevViewName = view.name, prevDate = cloneDate(date), reportEvents = function(a) { - if (prevViewName == view.name && +prevDate == +date) { // protects from fast switching - for (var i=0; i + + + + + + + + +
+ + diff --git a/tests/issue_221_quick_remove_source.html b/tests/issue_221_quick_remove_source.html new file mode 100644 index 0000000..bf37789 --- /dev/null +++ b/tests/issue_221_quick_remove_source.html @@ -0,0 +1,63 @@ + + + + + + + + + +
+ + diff --git a/tests/issue_251_empty_end_date.html b/tests/issue_251_empty_end_date.html new file mode 100644 index 0000000..ea155f2 --- /dev/null +++ b/tests/issue_251_empty_end_date.html @@ -0,0 +1,53 @@ + + + + + + + + + +
+ + diff --git a/tests/method_destroy.html b/tests/method_destroy.html new file mode 100644 index 0000000..11a7177 --- /dev/null +++ b/tests/method_destroy.html @@ -0,0 +1,46 @@ + + + + + + + + + +
some text in here
+ +