[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 /* 2 * FullCalendar v1.5.3 Google Calendar Plugin 3 * 4 * Copyright (c) 2011 Adam Shaw 5 * Dual licensed under the MIT and GPL licenses, located in 6 * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. 7 * 8 * Date: Mon Feb 6 22:40:40 2012 -0800 9 * 10 */ 11 12 (function($) { 13 14 15 var fc = $.fullCalendar; 16 var formatDate = fc.formatDate; 17 var parseISO8601 = fc.parseISO8601; 18 var addDays = fc.addDays; 19 var applyAll = fc.applyAll; 20 21 22 fc.sourceNormalizers.push(function(sourceOptions) { 23 if (sourceOptions.dataType == 'gcal' || 24 sourceOptions.dataType === undefined && 25 (sourceOptions.url || '').match(/^(http|https):\/\/www.google.com\/calendar\/feeds\//)) { 26 sourceOptions.dataType = 'gcal'; 27 if (sourceOptions.editable === undefined) { 28 sourceOptions.editable = false; 29 } 30 } 31 }); 32 33 34 fc.sourceFetchers.push(function(sourceOptions, start, end) { 35 if (sourceOptions.dataType == 'gcal') { 36 return transformOptions(sourceOptions, start, end); 37 } 38 }); 39 40 41 function transformOptions(sourceOptions, start, end) { 42 43 var success = sourceOptions.success; 44 var data = $.extend({}, sourceOptions.data || {}, { 45 'start-min': formatDate(start, 'u'), 46 'start-max': formatDate(end, 'u'), 47 'singleevents': true, 48 'max-results': 9999 49 }); 50 51 var ctz = sourceOptions.currentTimezone; 52 if (ctz) { 53 data.ctz = ctz = ctz.replace(' ', '_'); 54 } 55 56 return $.extend({}, sourceOptions, { 57 url: sourceOptions.url.replace(/\/basic$/, '/full') + '?alt=json-in-script&callback=?', 58 dataType: 'jsonp', 59 data: data, 60 startParam: false, 61 endParam: false, 62 success: function(data) { 63 var events = []; 64 if (data.feed.entry) { 65 $.each(data.feed.entry, function(i, entry) { 66 var startStr = entry['gd$when'][0]['startTime']; 67 var start = parseISO8601(startStr, true); 68 var end = parseISO8601(entry['gd$when'][0]['endTime'], true); 69 var allDay = startStr.indexOf('T') == -1; 70 var url; 71 $.each(entry.link, function(i, link) { 72 if (link.type == 'text/html') { 73 url = link.href; 74 if (ctz) { 75 url += (url.indexOf('?') == -1 ? '?' : '&') + 'ctz=' + ctz; 76 } 77 } 78 }); 79 if (allDay) { 80 addDays(end, -1); // make inclusive 81 } 82 events.push({ 83 id: entry['gCal$uid']['value'], 84 title: entry['title']['$t'], 85 url: url, 86 start: start, 87 end: end, 88 allDay: allDay, 89 location: entry['gd$where'][0]['valueString'], 90 description: entry['content']['$t'] 91 }); 92 }); 93 } 94 var args = [events].concat(Array.prototype.slice.call(arguments, 1)); 95 var res = applyAll(success, this, args); 96 if ($.isArray(res)) { 97 return res; 98 } 99 return events; 100 } 101 }); 102 103 } 104 105 106 // legacy 107 fc.gcalFeed = function(url, sourceOptions) { 108 return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' }); 109 }; 110 111 112 })(jQuery);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |