Browse Source

Mise à jour de fullcallendar en 1.6.7, qui supporte l'api calendar v3 de glouglou. (Franck)

svn/root/tags/plugins/organiseur/0.10.3 v0.10.3
marcimat@rezo.net 8 years ago
parent
commit
f7b07d51f3
  1. 2
      lib/fullcalendar/fullcalendar.css
  2. 8
      lib/fullcalendar/fullcalendar.js
  3. 6
      lib/fullcalendar/fullcalendar.min.js
  4. 2
      lib/fullcalendar/fullcalendar.print.css
  5. 162
      lib/fullcalendar/gcal.js
  6. 2
      paquet.xml

2
lib/fullcalendar/fullcalendar.css

@ -1,5 +1,5 @@
/*!
* FullCalendar v1.6.4 Stylesheet
* FullCalendar v1.6.7 Stylesheet
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/

8
lib/fullcalendar/fullcalendar.js

@ -1,5 +1,5 @@
/*!
* FullCalendar v1.6.4
* FullCalendar v1.6.7
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/
@ -115,7 +115,7 @@ var rtlDefaults = {
;;
var fc = $.fullCalendar = { version: "1.6.4" };
var fc = $.fullCalendar = { version: "1.6.7" };
var fcViews = fc.views = {};
@ -1290,7 +1290,7 @@ function EventManager(options, _sources) {
function getSourcePrimitive(source) {
return ((typeof source == 'object') ? (source.events || source.url) : '') || source;
return ((typeof source == 'object') ? (source.googleCalendarId || source.events || source.url) : '') || source;
}
@ -6107,4 +6107,4 @@ function HorizontalPositionCache(getElement) {
;;
})(jQuery);
})(jQuery);

6
lib/fullcalendar/fullcalendar.min.js vendored

File diff suppressed because one or more lines are too long

2
lib/fullcalendar/fullcalendar.print.css

@ -1,5 +1,5 @@
/*!
* FullCalendar v1.6.4 Print Stylesheet
* FullCalendar v1.6.7 Print Stylesheet
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/

162
lib/fullcalendar/gcal.js

@ -1,5 +1,5 @@
/*!
* FullCalendar v1.6.4 Google Calendar Plugin
* FullCalendar v1.6.7 Google Calendar Plugin
* Docs & License: http://arshaw.com/fullcalendar/
* (c) 2013 Adam Shaw
*/
@ -7,90 +7,156 @@
(function($) {
var API_BASE = 'https://www.googleapis.com/calendar/v3/calendars';
var fc = $.fullCalendar;
var formatDate = fc.formatDate;
var parseISO8601 = fc.parseISO8601;
var cloneDate = fc.cloneDate;
var addDays = fc.addDays;
var applyAll = fc.applyAll;
fc.sourceNormalizers.push(function(sourceOptions) {
if (sourceOptions.dataType == 'gcal' ||
sourceOptions.dataType === undefined &&
(sourceOptions.url || '').match(/^(http|https):\/\/www.google.com\/calendar\/feeds\//)) {
sourceOptions.dataType = 'gcal';
if (sourceOptions.editable === undefined) {
sourceOptions.editable = false;
}
var googleCalendarId = sourceOptions.googleCalendarId;
var url = sourceOptions.url;
var match;
// if the Google Calendar ID hasn't been explicitly defined
if (!googleCalendarId && url) {
// detect if the ID was specified as a single string
if ((match = /^[^\/]+@([^\/]+\.)?calendar\.google\.com$/.test(url))) {
googleCalendarId = url;
}
// try to scrape it out of a V1 or V3 API feed URL
else if (
(match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) ||
(match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url))
) {
googleCalendarId = decodeURIComponent(match[1]);
}
if (googleCalendarId) {
sourceOptions.googleCalendarId = googleCalendarId;
}
}
if (googleCalendarId) { // is this a Google Calendar?
// make each Google Calendar source uneditable by default
if (sourceOptions.editable == null) {
sourceOptions.editable = false;
}
// We want removeEventSource to work, but it won't know about the googleCalendarId primitive.
// Shoehorn it into the url, which will function as the unique primitive. Won't cause side effects.
// This hack is obsolete since 1.6.7, but keep it so this plugin file is compatible with old versions.
sourceOptions.url = googleCalendarId;
}
});
fc.sourceFetchers.push(function(sourceOptions, start, end) {
if (sourceOptions.dataType == 'gcal') {
if (sourceOptions.googleCalendarId) {
return transformOptions(sourceOptions, start, end);
}
});
function transformOptions(sourceOptions, start, end) {
var url = API_BASE + '/' + encodeURIComponent(sourceOptions.googleCalendarId) + '/events?callback=?'; // jsonp
var apiKey = sourceOptions.googleCalendarApiKey;
var ctz = sourceOptions.currentTimezone;
var success = sourceOptions.success;
var data = $.extend({}, sourceOptions.data || {}, {
'start-min': formatDate(start, 'u'),
'start-max': formatDate(end, 'u'),
'singleevents': true,
'max-results': 9999
var data;
function reportError(message, apiErrorObjs) {
var errorObjs = apiErrorObjs || [ { message: message } ]; // to be passed into error handlers
var consoleObj = window.console;
var consoleWarnFunc = consoleObj ? (consoleObj.warn || consoleObj.log) : null;
// call error handlers
(sourceOptions.googleCalendarError || $.noop).apply(null, errorObjs);
// print error to debug console
if (consoleWarnFunc) {
consoleWarnFunc.apply(consoleObj, [ message ].concat(apiErrorObjs || []));
}
}
// The API expects an ISO8601 datetime with a time and timezone part.
// Since the calendar's timezone offset isn't always known, request the date in UTC and pad it by a day on each
// side, guaranteeing we will receive all events in the desired range, albeit a superset.
start = addDays(cloneDate(start), -1);
end = addDays(cloneDate(end), 1);
if (!apiKey) {
reportError("Specify a googleCalendarApiKey. See http://fullcalendar.io/docs1/google_calendar/");
return {}; // an empty source to use instead. won't fetch anything.
}
data = $.extend({}, sourceOptions.data || {}, {
key: apiKey,
timeMin: formatDate(start, 'u'),
timeMax: formatDate(end, 'u'),
singleEvents: true,
maxResults: 9999
});
var ctz = sourceOptions.currentTimezone;
if (ctz) {
data.ctz = ctz = ctz.replace(' ', '_');
data.timeZone = ctz = ctz.replace(' ', '_');
}
return $.extend({}, sourceOptions, {
url: sourceOptions.url.replace(/\/basic$/, '/full') + '?alt=json-in-script&callback=?',
dataType: 'jsonp',
googleCalendarId: null, // prevents source-normalizing from happening again
url: url,
data: data,
startParam: false,
endParam: false,
startParam: false, // `false` omits this parameter. we already included it above
endParam: false, // same
success: function(data) {
var events = [];
if (data.feed.entry) {
$.each(data.feed.entry, function(i, entry) {
var startStr = entry['gd$when'][0]['startTime'];
var start = parseISO8601(startStr, true);
var end = parseISO8601(entry['gd$when'][0]['endTime'], true);
var allDay = startStr.indexOf('T') == -1;
var url;
$.each(entry.link, function(i, link) {
if (link.type == 'text/html') {
url = link.href;
if (ctz) {
url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz;
}
}
});
var successArgs;
var successRes;
if (data.error) {
reportError('Google Calendar API: ' + data.error.message, data.error.errors);
}
else if (data.items) {
$.each(data.items, function(i, entry) {
var allDay = !entry.start.dateTime && !entry.end.dateTime;
var start = parseISO8601(entry.start.dateTime || entry.start.date, true);
var end = parseISO8601(entry.end.dateTime || entry.end.date, true);
var url = entry.htmlLink;
if (allDay) {
addDays(end, -1); // make inclusive
}
if (ctz) {
url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz;
}
events.push({
id: entry['gCal$uid']['value'],
title: entry['title']['$t'],
url: url,
id: entry.id,
title: entry.summary,
allDay: allDay,
start: start,
end: end,
allDay: allDay,
location: entry['gd$where'][0]['valueString'],
description: entry['content']['$t']
url: url,
location: entry.location,
description: entry.description
});
});
// call the success handler(s) and allow it to return a new events array
successArgs = [ events ].concat(Array.prototype.slice.call(arguments, 1)); // forward other jq args
successRes = applyAll(success, this, successArgs);
if ($.isArray(successRes)) {
return successRes;
}
}
var args = [events].concat(Array.prototype.slice.call(arguments, 1));
var res = applyAll(success, this, args);
if ($.isArray(res)) {
return res;
}
return events;
}
});
@ -100,7 +166,7 @@ function transformOptions(sourceOptions, start, end) {
// legacy
fc.gcalFeed = function(url, sourceOptions) {
return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' });
return $.extend({}, sourceOptions, { url: url });
};

2
paquet.xml

@ -1,7 +1,7 @@
<paquet
prefix="organiseur"
categorie="date"
version="0.10.2"
version="0.10.3"
etat="stable"
compatibilite="[3.0.0;3.1.*]"
logo="prive/themes/spip/images/calendrier-32.png"

Loading…
Cancel
Save