bugfixes for 1.5
This commit is contained in:
parent
3dd0572c5c
commit
f13a29fac3
18 changed files with 124 additions and 87 deletions
|
@ -114,7 +114,7 @@ function Calendar(element, options, eventSources) {
|
||||||
$(window).unbind('resize', windowResize);
|
$(window).unbind('resize', windowResize);
|
||||||
header.destroy();
|
header.destroy();
|
||||||
content.remove();
|
content.remove();
|
||||||
element.removeClass('fc fc-rtl fc-ui-widget');
|
element.removeClass('fc fc-rtl ui-widget');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,12 @@ fc.sourceFetchers = [];
|
||||||
|
|
||||||
var ajaxDefaults = {
|
var ajaxDefaults = {
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
cache: true // because we are using the cacheParam option (TODO: deprecate)
|
cache: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var eventGUID = 1;
|
var eventGUID = 1;
|
||||||
|
|
||||||
|
|
||||||
function EventManager(options, _sources) {
|
function EventManager(options, _sources) {
|
||||||
var t = this;
|
var t = this;
|
||||||
|
|
||||||
|
@ -74,8 +75,8 @@ function EventManager(options, _sources) {
|
||||||
if (fetchID == currentFetchID) {
|
if (fetchID == currentFetchID) {
|
||||||
if (events) {
|
if (events) {
|
||||||
for (var i=0; i<events.length; i++) {
|
for (var i=0; i<events.length; i++) {
|
||||||
normalizeEvent(events[i], source);
|
|
||||||
events[i].source = source;
|
events[i].source = source;
|
||||||
|
normalizeEvent(events[i]);
|
||||||
}
|
}
|
||||||
cache = cache.concat(events);
|
cache = cache.concat(events);
|
||||||
}
|
}
|
||||||
|
@ -128,16 +129,12 @@ function EventManager(options, _sources) {
|
||||||
var data = $.extend({}, source.data || {});
|
var data = $.extend({}, source.data || {});
|
||||||
var startParam = firstDefined(source.startParam, options.startParam);
|
var startParam = firstDefined(source.startParam, options.startParam);
|
||||||
var endParam = firstDefined(source.endParam, options.endParam);
|
var endParam = firstDefined(source.endParam, options.endParam);
|
||||||
var cacheParam = firstDefined(source.cacheParam, options.cacheParam);
|
|
||||||
if (startParam) {
|
if (startParam) {
|
||||||
data[startParam] = Math.round(+rangeStart / 1000);
|
data[startParam] = Math.round(+rangeStart / 1000);
|
||||||
}
|
}
|
||||||
if (endParam) {
|
if (endParam) {
|
||||||
data[endParam] = Math.round(+rangeEnd / 1000);
|
data[endParam] = Math.round(+rangeEnd / 1000);
|
||||||
}
|
}
|
||||||
if (cacheParam) {
|
|
||||||
data[cacheParam] = +new Date();
|
|
||||||
}
|
|
||||||
pushLoading();
|
pushLoading();
|
||||||
$.ajax($.extend({}, ajaxDefaults, source, {
|
$.ajax($.extend({}, ajaxDefaults, source, {
|
||||||
data: data,
|
data: data,
|
||||||
|
@ -158,6 +155,8 @@ function EventManager(options, _sources) {
|
||||||
popLoading();
|
popLoading();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
}else{
|
||||||
|
callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,16 +233,20 @@ function EventManager(options, _sources) {
|
||||||
e.allDay = event.allDay;
|
e.allDay = event.allDay;
|
||||||
e.className = event.className;
|
e.className = event.className;
|
||||||
e.editable = event.editable;
|
e.editable = event.editable;
|
||||||
normalizeEvent(e, e.source);
|
e.color = event.color;
|
||||||
|
e.backgroudColor = event.backgroudColor;
|
||||||
|
e.borderColor = event.borderColor;
|
||||||
|
e.textColor = event.textColor;
|
||||||
|
normalizeEvent(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
normalizeEvent(event, event.source);
|
normalizeEvent(event);
|
||||||
reportEvents(cache);
|
reportEvents(cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function renderEvent(event, stick) {
|
function renderEvent(event, stick) {
|
||||||
normalizeEvent(event, event.source || stickySource);
|
normalizeEvent(event);
|
||||||
if (!event.source) {
|
if (!event.source) {
|
||||||
if (stick) {
|
if (stick) {
|
||||||
stickySource.events.push(event);
|
stickySource.events.push(event);
|
||||||
|
@ -321,7 +324,9 @@ function EventManager(options, _sources) {
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
function normalizeEvent(event, source) {
|
function normalizeEvent(event) {
|
||||||
|
var source = event.source || {};
|
||||||
|
var ignoreTimezone = firstDefined(source.ignoreTimezone, options.ignoreTimezone);
|
||||||
event._id = event._id || (event.id === undefined ? '_fc' + eventGUID++ : event.id + '');
|
event._id = event._id || (event.id === undefined ? '_fc' + eventGUID++ : event.id + '');
|
||||||
if (event.date) {
|
if (event.date) {
|
||||||
if (!event.start) {
|
if (!event.start) {
|
||||||
|
@ -329,8 +334,8 @@ function EventManager(options, _sources) {
|
||||||
}
|
}
|
||||||
delete event.date;
|
delete event.date;
|
||||||
}
|
}
|
||||||
event._start = cloneDate(event.start = parseDate(event.start, firstDefined(source.ignoreTimezone, options.ignoreTimezone)));
|
event._start = cloneDate(event.start = parseDate(event.start, ignoreTimezone));
|
||||||
event.end = parseDate(event.end, options.ignoreTimezone);
|
event.end = parseDate(event.end, ignoreTimezone);
|
||||||
if (event.end && event.end <= event.start) {
|
if (event.end && event.end <= event.start) {
|
||||||
event.end = null;
|
event.end = null;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +361,7 @@ function EventManager(options, _sources) {
|
||||||
|
|
||||||
function normalizeSource(source) {
|
function normalizeSource(source) {
|
||||||
if (source.className) {
|
if (source.className) {
|
||||||
// TODO: repeate code, same code for event classNames
|
// TODO: repeat code, same code for event classNames
|
||||||
if (typeof source.className == 'string') {
|
if (typeof source.className == 'string') {
|
||||||
source.className = source.className.split(/\s+/);
|
source.className = source.className.split(/\s+/);
|
||||||
}
|
}
|
||||||
|
@ -371,7 +376,7 @@ function EventManager(options, _sources) {
|
||||||
|
|
||||||
|
|
||||||
function isSourcesEqual(source1, source2) {
|
function isSourcesEqual(source1, source2) {
|
||||||
return getSourcePrimitive(source1) == getSourcePrimitive(source2);
|
return source1 && source2 && getSourcePrimitive(source1) == getSourcePrimitive(source2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ function AgendaEventRenderer() {
|
||||||
vsideCache={},
|
vsideCache={},
|
||||||
hsideCache={},
|
hsideCache={},
|
||||||
key, val,
|
key, val,
|
||||||
titleSpan,
|
contentElement,
|
||||||
height,
|
height,
|
||||||
slotSegmentContainer = getSlotSegmentContainer(),
|
slotSegmentContainer = getSlotSegmentContainer(),
|
||||||
rtl, dis, dit,
|
rtl, dis, dit,
|
||||||
|
@ -245,9 +245,9 @@ function AgendaEventRenderer() {
|
||||||
seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement, true)) : val;
|
seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement, true)) : val;
|
||||||
val = hsideCache[key];
|
val = hsideCache[key];
|
||||||
seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement, true)) : val;
|
seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement, true)) : val;
|
||||||
titleSpan = eventElement.find('span.fc-event-title');
|
contentElement = eventElement.find('div.fc-event-content');
|
||||||
if (titleSpan.length) {
|
if (contentElement.length) {
|
||||||
seg.titleTop = titleSpan[0].offsetTop;
|
seg.contentTop = contentElement[0].offsetTop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,11 +260,11 @@ function AgendaEventRenderer() {
|
||||||
height = Math.max(0, seg.outerHeight - seg.vsides);
|
height = Math.max(0, seg.outerHeight - seg.vsides);
|
||||||
eventElement[0].style.height = height + 'px';
|
eventElement[0].style.height = height + 'px';
|
||||||
event = seg.event;
|
event = seg.event;
|
||||||
if (seg.titleTop !== undefined && height - seg.titleTop < 10) {
|
if (seg.contentTop !== undefined && height - seg.contentTop < 10) {
|
||||||
// not enough room for title, put it in the time header
|
// not enough room for title, put it in the time header
|
||||||
eventElement.find('span.fc-event-time')
|
eventElement.find('div.fc-event-time')
|
||||||
.text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title);
|
.text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title);
|
||||||
eventElement.find('span.fc-event-title')
|
eventElement.find('div.fc-event-title')
|
||||||
.remove();
|
.remove();
|
||||||
}
|
}
|
||||||
trigger('eventAfterRender', event, event, eventElement);
|
trigger('eventAfterRender', event, event, eventElement);
|
||||||
|
@ -289,7 +289,10 @@ function AgendaEventRenderer() {
|
||||||
if (seg.isEnd) {
|
if (seg.isEnd) {
|
||||||
classes.push('fc-corner-bottom');
|
classes.push('fc-corner-bottom');
|
||||||
}
|
}
|
||||||
classes = classes.concat(event.className, event.source.className);
|
classes = classes.concat(event.className);
|
||||||
|
if (event.source) {
|
||||||
|
classes = classes.concat(event.source.className || []);
|
||||||
|
}
|
||||||
if (url) {
|
if (url) {
|
||||||
html += "a href='" + htmlEscape(event.url) + "'";
|
html += "a href='" + htmlEscape(event.url) + "'";
|
||||||
}else{
|
}else{
|
||||||
|
@ -335,7 +338,7 @@ function AgendaEventRenderer() {
|
||||||
|
|
||||||
|
|
||||||
function bindSlotSeg(event, eventElement, seg) {
|
function bindSlotSeg(event, eventElement, seg) {
|
||||||
var timeElement = eventElement.find('span.fc-event-time');
|
var timeElement = eventElement.find('div.fc-event-time');
|
||||||
if (isEventDraggable(event)) {
|
if (isEventDraggable(event)) {
|
||||||
draggableSlotEvent(event, eventElement, timeElement);
|
draggableSlotEvent(event, eventElement, timeElement);
|
||||||
}
|
}
|
||||||
|
@ -516,6 +519,7 @@ function AgendaEventRenderer() {
|
||||||
}else{
|
}else{
|
||||||
// either no change or out-of-bounds (draggable has already reverted)
|
// either no change or out-of-bounds (draggable has already reverted)
|
||||||
resetElement();
|
resetElement();
|
||||||
|
eventElement.css('filter', ''); // clear IE opacity side-effects
|
||||||
eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
|
eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
|
||||||
updateTimeText(0);
|
updateTimeText(0);
|
||||||
showEvents(event, eventElement);
|
showEvents(event, eventElement);
|
||||||
|
|
|
@ -179,7 +179,7 @@ function AgendaView(element, calendar, viewName) {
|
||||||
"<th class='fc-agenda-axis " + headerClass + "'> </th>";
|
"<th class='fc-agenda-axis " + headerClass + "'> </th>";
|
||||||
for (i=0; i<colCnt; i++) {
|
for (i=0; i<colCnt; i++) {
|
||||||
s +=
|
s +=
|
||||||
"<th class='fc- fc-col" + i + ' ' + headerClass + "'/>";
|
"<th class='fc- fc-col" + i + ' ' + headerClass + "'/>"; // fc- needed for setDayID
|
||||||
}
|
}
|
||||||
s +=
|
s +=
|
||||||
"<th class='fc-agenda-gutter " + headerClass + "'> </th>" +
|
"<th class='fc-agenda-gutter " + headerClass + "'> </th>" +
|
||||||
|
@ -190,7 +190,7 @@ function AgendaView(element, calendar, viewName) {
|
||||||
"<th class='fc-agenda-axis " + headerClass + "'> </th>";
|
"<th class='fc-agenda-axis " + headerClass + "'> </th>";
|
||||||
for (i=0; i<colCnt; i++) {
|
for (i=0; i<colCnt; i++) {
|
||||||
s +=
|
s +=
|
||||||
"<td class='fc- fc-col" + i + ' ' + contentClass + "'>" +
|
"<td class='fc- fc-col" + i + ' ' + contentClass + "'>" + // fc- needed for setDayID
|
||||||
"<div>" +
|
"<div>" +
|
||||||
"<div class='fc-day-content'>" +
|
"<div class='fc-day-content'>" +
|
||||||
"<div style='position:relative'> </div>" +
|
"<div style='position:relative'> </div>" +
|
||||||
|
@ -434,7 +434,7 @@ function AgendaView(element, calendar, viewName) {
|
||||||
|
|
||||||
|
|
||||||
function slotClick(ev) {
|
function slotClick(ev) {
|
||||||
if (!opt('selectable')) { // SelectionManager will worry about dayClick
|
if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
|
||||||
var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth));
|
var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth));
|
||||||
var date = colDate(col);
|
var date = colDate(col);
|
||||||
var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data
|
var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data
|
||||||
|
@ -702,9 +702,8 @@ function AgendaView(element, calendar, viewName) {
|
||||||
title: '',
|
title: '',
|
||||||
start: startDate,
|
start: startDate,
|
||||||
end: endDate,
|
end: endDate,
|
||||||
className: [],
|
className: ['fc-select-helper'],
|
||||||
editable: false,
|
editable: false
|
||||||
source: {}
|
|
||||||
},
|
},
|
||||||
rect
|
rect
|
||||||
));
|
));
|
||||||
|
|
|
@ -118,7 +118,8 @@
|
||||||
filter: alpha(opacity=30);
|
filter: alpha(opacity=30);
|
||||||
}
|
}
|
||||||
|
|
||||||
.fc .ui-draggable-dragging .fc-event-bg {
|
.fc .ui-draggable-dragging .fc-event-bg, /* TODO: something nicer like .fc-opacity */
|
||||||
|
.fc-select-helper .fc-event-bg {
|
||||||
display: none\9; /* for IE6/7/8. nested opacity filters while dragging don't work */
|
display: none\9; /* for IE6/7/8. nested opacity filters while dragging don't work */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ function BasicView(element, calendar, viewName) {
|
||||||
"<tr>";
|
"<tr>";
|
||||||
for (i=0; i<colCnt; i++) {
|
for (i=0; i<colCnt; i++) {
|
||||||
s +=
|
s +=
|
||||||
"<th class='fc- " + headerClass + "'/>";
|
"<th class='fc- " + headerClass + "'/>"; // need fc- for setDayID
|
||||||
}
|
}
|
||||||
s +=
|
s +=
|
||||||
"</tr>" +
|
"</tr>" +
|
||||||
|
@ -140,7 +140,7 @@ function BasicView(element, calendar, viewName) {
|
||||||
"<tr class='fc-week" + i + "'>";
|
"<tr class='fc-week" + i + "'>";
|
||||||
for (j=0; j<colCnt; j++) {
|
for (j=0; j<colCnt; j++) {
|
||||||
s +=
|
s +=
|
||||||
"<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" +
|
"<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" + // need fc- for setDayID
|
||||||
"<div>" +
|
"<div>" +
|
||||||
(showNumbers ?
|
(showNumbers ?
|
||||||
"<div class='fc-day-number'/>" :
|
"<div class='fc-day-number'/>" :
|
||||||
|
@ -182,14 +182,14 @@ function BasicView(element, calendar, viewName) {
|
||||||
|
|
||||||
|
|
||||||
function updateCells(firstTime) {
|
function updateCells(firstTime) {
|
||||||
var optimize = !firstTime && rowCnt > 1;
|
var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating?
|
||||||
var month = t.start.getMonth();
|
var month = t.start.getMonth();
|
||||||
var today = clearTime(new Date());
|
var today = clearTime(new Date());
|
||||||
var cell;
|
var cell;
|
||||||
var date;
|
var date;
|
||||||
var row;
|
var row;
|
||||||
|
|
||||||
if (!optimize) {
|
if (dowDirty) {
|
||||||
headCells.each(function(i, _cell) {
|
headCells.each(function(i, _cell) {
|
||||||
cell = $(_cell);
|
cell = $(_cell);
|
||||||
date = indexDate(i);
|
date = indexDate(i);
|
||||||
|
@ -212,7 +212,7 @@ function BasicView(element, calendar, viewName) {
|
||||||
cell.removeClass(tm + '-state-highlight fc-today');
|
cell.removeClass(tm + '-state-highlight fc-today');
|
||||||
}
|
}
|
||||||
cell.find('div.fc-day-number').text(date.getDate());
|
cell.find('div.fc-day-number').text(date.getDate());
|
||||||
if (!optimize) {
|
if (dowDirty) {
|
||||||
setDayID(cell, date);
|
setDayID(cell, date);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -282,7 +282,7 @@ function BasicView(element, calendar, viewName) {
|
||||||
|
|
||||||
|
|
||||||
function dayClick(ev) {
|
function dayClick(ev) {
|
||||||
if (!opt('selectable')) { // SelectionManager will worry about dayClick
|
if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
|
||||||
var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data
|
var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data
|
||||||
var date = indexDate(index);
|
var date = indexDate(index);
|
||||||
trigger('dayClick', this, date, true, ev);
|
trigger('dayClick', this, date, true, ev);
|
||||||
|
|
|
@ -126,7 +126,8 @@ function DayEventRenderer() {
|
||||||
var bounds = allDayBounds();
|
var bounds = allDayBounds();
|
||||||
var minLeft = bounds.left;
|
var minLeft = bounds.left;
|
||||||
var maxLeft = bounds.right;
|
var maxLeft = bounds.right;
|
||||||
var cols = []; // don't really like this system (but have to do this b/c RTL works differently in basic vs agenda)
|
var leftCol;
|
||||||
|
var rightCol;
|
||||||
var left;
|
var left;
|
||||||
var right;
|
var right;
|
||||||
var skinCss;
|
var skinCss;
|
||||||
|
@ -146,10 +147,10 @@ function DayEventRenderer() {
|
||||||
if (seg.isEnd) {
|
if (seg.isEnd) {
|
||||||
classes.push('fc-corner-left');
|
classes.push('fc-corner-left');
|
||||||
}
|
}
|
||||||
cols[0] = dayOfWeekCol(seg.end.getDay()-1);
|
leftCol = dayOfWeekCol(seg.end.getDay()-1);
|
||||||
cols[1] = dayOfWeekCol(seg.start.getDay());
|
rightCol = dayOfWeekCol(seg.start.getDay());
|
||||||
left = seg.isEnd ? colContentLeft(cols[0]) : minLeft;
|
left = seg.isEnd ? colContentLeft(leftCol) : minLeft;
|
||||||
right = seg.isStart ? colContentRight(cols[1]) : maxLeft;
|
right = seg.isStart ? colContentRight(rightCol) : maxLeft;
|
||||||
}else{
|
}else{
|
||||||
if (seg.isStart) {
|
if (seg.isStart) {
|
||||||
classes.push('fc-corner-left');
|
classes.push('fc-corner-left');
|
||||||
|
@ -157,12 +158,15 @@ function DayEventRenderer() {
|
||||||
if (seg.isEnd) {
|
if (seg.isEnd) {
|
||||||
classes.push('fc-corner-right');
|
classes.push('fc-corner-right');
|
||||||
}
|
}
|
||||||
cols[0] = dayOfWeekCol(seg.start.getDay());
|
leftCol = dayOfWeekCol(seg.start.getDay());
|
||||||
cols[1] = dayOfWeekCol(seg.end.getDay()-1);
|
rightCol = dayOfWeekCol(seg.end.getDay()-1);
|
||||||
left = seg.isStart ? colContentLeft(cols[0]) : minLeft;
|
left = seg.isStart ? colContentLeft(leftCol) : minLeft;
|
||||||
right = seg.isEnd ? colContentRight(cols[1]) : maxLeft;
|
right = seg.isEnd ? colContentRight(rightCol) : maxLeft;
|
||||||
|
}
|
||||||
|
classes = classes.concat(event.className);
|
||||||
|
if (event.source) {
|
||||||
|
classes = classes.concat(event.source.className || []);
|
||||||
}
|
}
|
||||||
classes = classes.concat(event.className, event.source.className);
|
|
||||||
url = event.url;
|
url = event.url;
|
||||||
skinCss = getSkinCss(event, opt);
|
skinCss = getSkinCss(event, opt);
|
||||||
if (url) {
|
if (url) {
|
||||||
|
@ -197,9 +201,8 @@ function DayEventRenderer() {
|
||||||
"</" + (url ? "a" : "div" ) + ">";
|
"</" + (url ? "a" : "div" ) + ">";
|
||||||
seg.left = left;
|
seg.left = left;
|
||||||
seg.outerWidth = right - left;
|
seg.outerWidth = right - left;
|
||||||
cols.sort(cmp); // is this still needed now that cols are always left-to-right?
|
seg.startCol = leftCol;
|
||||||
seg.startCol = cols[0];
|
seg.endCol = rightCol + 1; // needs to be exclusive
|
||||||
seg.endCol = cols[1] + 1;
|
|
||||||
}
|
}
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
@ -409,7 +412,7 @@ function DayEventRenderer() {
|
||||||
var rowCnt = getRowCnt();
|
var rowCnt = getRowCnt();
|
||||||
var colCnt = getColCnt();
|
var colCnt = getColCnt();
|
||||||
var dis = rtl ? -1 : 1;
|
var dis = rtl ? -1 : 1;
|
||||||
var dit = rtl ? colCnt : 0;
|
var dit = rtl ? colCnt-1 : 0;
|
||||||
var elementTop = element.css('top');
|
var elementTop = element.css('top');
|
||||||
var dayDelta;
|
var dayDelta;
|
||||||
var helpers;
|
var helpers;
|
||||||
|
|
|
@ -76,7 +76,7 @@ function View(element, calendar, viewName) {
|
||||||
|
|
||||||
|
|
||||||
function isEventEditable(event) {
|
function isEventEditable(event) {
|
||||||
return firstDefined(event.editable, event.source.editable, opt('editable'));
|
return firstDefined(event.editable, (event.source || {}).editable, opt('editable'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
/*
|
||||||
|
* FullCalendar v@VERSION Google Calendar Plugin
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 Adam Shaw
|
||||||
|
* Dual licensed under the MIT and GPL licenses, located in
|
||||||
|
* MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
|
||||||
|
*
|
||||||
|
* Date: @DATE
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +22,7 @@ var applyAll = fc.applyAll;
|
||||||
fc.sourceNormalizers.push(function(sourceOptions) {
|
fc.sourceNormalizers.push(function(sourceOptions) {
|
||||||
if (sourceOptions.dataType == 'gcal' ||
|
if (sourceOptions.dataType == 'gcal' ||
|
||||||
sourceOptions.dataType === undefined &&
|
sourceOptions.dataType === undefined &&
|
||||||
(sourceOptions.url || '').indexOf('http://www.google.com/calendar/feeds/') == 0) {
|
(sourceOptions.url || '').match(/^(http|https):\/\/www.google.com\/calendar\/feeds\//)) {
|
||||||
sourceOptions.dataType = 'gcal';
|
sourceOptions.dataType = 'gcal';
|
||||||
if (sourceOptions.editable === undefined) {
|
if (sourceOptions.editable === undefined) {
|
||||||
sourceOptions.editable = false;
|
sourceOptions.editable = false;
|
||||||
|
@ -48,8 +59,6 @@ function transformOptions(sourceOptions, start, end) {
|
||||||
data: data,
|
data: data,
|
||||||
startParam: false,
|
startParam: false,
|
||||||
endParam: false,
|
endParam: false,
|
||||||
cacheParam: false,
|
|
||||||
cache: false, // TODO: when we remove cacheParam, we can also remove this
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var events = [];
|
var events = [];
|
||||||
if (data.feed.entry) {
|
if (data.feed.entry) {
|
||||||
|
@ -94,6 +103,7 @@ function transformOptions(sourceOptions, start, end) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// legacy
|
||||||
fc.gcalFeed = function(url, sourceOptions) {
|
fc.gcalFeed = function(url, sourceOptions) {
|
||||||
return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' });
|
return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' });
|
||||||
};
|
};
|
||||||
|
|
|
@ -303,12 +303,13 @@ function markFirstLast(e) {
|
||||||
function setDayID(cell, date) {
|
function setDayID(cell, date) {
|
||||||
cell.each(function(i, _cell) {
|
cell.each(function(i, _cell) {
|
||||||
_cell.className = _cell.className.replace(/^fc-\w*/, 'fc-' + dayIDs[date.getDay()]);
|
_cell.className = _cell.className.replace(/^fc-\w*/, 'fc-' + dayIDs[date.getDay()]);
|
||||||
|
// TODO: make a way that doesn't rely on order of classes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getSkinCss(event, opt) {
|
function getSkinCss(event, opt) {
|
||||||
var source = event.source;
|
var source = event.source || {};
|
||||||
var eventColor = event.color;
|
var eventColor = event.color;
|
||||||
var sourceColor = source.color;
|
var sourceColor = source.color;
|
||||||
var optionColor = opt('eventColor');
|
var optionColor = opt('eventColor');
|
||||||
|
@ -329,7 +330,7 @@ function getSkinCss(event, opt) {
|
||||||
var textColor =
|
var textColor =
|
||||||
event.textColor ||
|
event.textColor ||
|
||||||
source.textColor ||
|
source.textColor ||
|
||||||
opt('textColor');
|
opt('eventTextColor');
|
||||||
var statements = [];
|
var statements = [];
|
||||||
if (backgroundColor) {
|
if (backgroundColor) {
|
||||||
statements.push('background-color:' + backgroundColor);
|
statements.push('background-color:' + backgroundColor);
|
||||||
|
|
|
@ -13,22 +13,27 @@
|
||||||
center: 'title',
|
center: 'title',
|
||||||
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
|
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
|
||||||
},
|
},
|
||||||
editable: true,
|
//editable: true,
|
||||||
eventSources: [
|
eventSources: [
|
||||||
|
{
|
||||||
|
url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic",
|
||||||
|
editable: true,
|
||||||
|
className: 'holiday'
|
||||||
|
},
|
||||||
|
/*
|
||||||
$.fullCalendar.gcalFeed(
|
$.fullCalendar.gcalFeed(
|
||||||
"http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic",
|
"http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic",
|
||||||
{
|
{
|
||||||
editable: true,
|
editable: true,
|
||||||
className: ['holiday']
|
className: 'holiday'
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
$.fullCalendar.gcalFeed(
|
*/
|
||||||
"http://www.google.com/calendar/feeds/b62ul6i1vvfh9vqabsal835028%40group.calendar.google.com/public/basic", // most recent event in Nov 2009
|
{
|
||||||
{
|
url: "https://www.google.com/calendar/feeds/ht3jlfaac5lfd6263ulfh4tql8%40group.calendar.google.com/public/basic",
|
||||||
editable: true,
|
currentTimezone: 'America/Edmonton', // 'America/Los_Angeles' 'America/Los Angeles'
|
||||||
currentTimezone: 'America/Edmonton' // 'America/Los_Angeles' 'America/Los Angeles'
|
editable: true
|
||||||
}
|
}
|
||||||
)
|
|
||||||
],
|
],
|
||||||
eventClick: function(event) {
|
eventClick: function(event) {
|
||||||
console.log(event.start);
|
console.log(event.start);
|
||||||
|
@ -41,12 +46,8 @@
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.holiday,
|
.holiday * {
|
||||||
.fc-agenda .holiday .fc-event-time,
|
color: yellow !important;
|
||||||
.holiday a {
|
|
||||||
background: green;
|
|
||||||
border-color: green;
|
|
||||||
color: yellow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel='stylesheet' type='text/css' href='lib/fancybox/jquery.fancybox-1.2.6.css' />
|
<link rel='stylesheet' type='text/css' href='lib/fancybox/jquery.fancybox-1.2.6.css' />
|
||||||
<script type='text/javascript' src='../lib/jquery-1.4.4.min.js'></script>
|
<script type='text/javascript' src='../lib/jquery-1.5.min.js'></script>
|
||||||
<script type='text/javascript' src='lib/fancybox/jquery.fancybox-1.2.6.pack.js'></script>
|
<script type='text/javascript' src='lib/fancybox/jquery.fancybox-1.2.6.pack.js'></script>
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
/* http://code.google.com/p/fullcalendar/issues/detail?id=193 */
|
/* http://code.google.com/p/fullcalendar/issues/detail?id=193 */
|
||||||
.fc .fc-sat, .fc .fc-sun { background-color:red }
|
.fc .fc-sat, .fc .fc-sun { background-color:red }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script type='text/javascript' src='../src/_loader.js?debug'></script>
|
<script type='text/javascript' src='../src/_loader.js?debug'></script>
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
left: 'prev,next today',
|
left: 'prev,next today',
|
||||||
center: 'title',
|
center: 'title',
|
||||||
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
|
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
|
||||||
}
|
},
|
||||||
|
theme: true
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(cal.data('fullCalendar'));
|
console.log(cal.data('fullCalendar'));
|
||||||
|
|
|
@ -96,6 +96,8 @@
|
||||||
event.title = "repeat yo";
|
event.title = "repeat yo";
|
||||||
//event.editable = false;
|
//event.editable = false;
|
||||||
event.url = "http://google.com/";
|
event.url = "http://google.com/";
|
||||||
|
event.color = 'red';
|
||||||
|
event.textColor = 'green';
|
||||||
cal.fullCalendar('updateEvent', event);
|
cal.fullCalendar('updateEvent', event);
|
||||||
//console.log(cal.fullCalendar('clientEvents', 2));
|
//console.log(cal.fullCalendar('clientEvents', 2));
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
selectable: true,
|
selectable: true,
|
||||||
selectHelper: true,
|
selectHelper: true,
|
||||||
|
|
||||||
weekends: false,
|
//weekends: false,
|
||||||
|
|
||||||
height: 700,
|
height: 700,
|
||||||
//contentHeight: 500,
|
//contentHeight: 500,
|
||||||
|
@ -78,10 +78,18 @@
|
||||||
//},
|
//},
|
||||||
//isRTL: true,
|
//isRTL: true,
|
||||||
|
|
||||||
|
eventColor: 'green',
|
||||||
|
eventTextColor: 'yellow',
|
||||||
|
eventBorderColor: 'black',
|
||||||
|
//eventBackgroundColor: 'red',
|
||||||
events: [
|
events: [
|
||||||
{
|
{
|
||||||
title: 'All Day Event',
|
title: 'All Day Event',
|
||||||
start: new Date(y, m, 1)
|
start: new Date(y, m, 1),
|
||||||
|
color: 'gray',
|
||||||
|
//backgroundColor: 'red',
|
||||||
|
textColor: 'white',
|
||||||
|
borderColor: '#000'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Long Event',
|
title: 'Long Event',
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
start: new Date(y, m, d, 12, 0),
|
start: new Date(y, m, d, 12, 0),
|
||||||
end: new Date(y, m, d, 14, 0),
|
end: new Date(y, m, d, 14, 0),
|
||||||
allDay: false,
|
allDay: false,
|
||||||
//className: 'yellow-event black-text-event',
|
//className: 'yellow-event black-text-event'
|
||||||
className: ['yellow-event', 'black-text-event']
|
className: ['yellow-event', 'black-text-event']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -132,8 +132,7 @@
|
||||||
/*
|
/*
|
||||||
,
|
,
|
||||||
startParam: 'mystart',
|
startParam: 'mystart',
|
||||||
endParam: 'myend',
|
endParam: 'myend'
|
||||||
cacheParam: 'uniq'
|
|
||||||
*/
|
*/
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -141,16 +140,19 @@
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
.red-event a {
|
.red-event,
|
||||||
background: red;
|
.red-event .fc-event-skin {
|
||||||
|
background: red !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.yellow-event a {
|
.yellow-event,
|
||||||
background: yellow;
|
.yellow-event .fc-event-skin {
|
||||||
|
background: yellow !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.black-text-event a {
|
.black-text-event,
|
||||||
color: #000;
|
.black-text-event .fc-event-skin {
|
||||||
|
color: #000 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#calendar').fullCalendar({
|
$('#calendar').fullCalendar({
|
||||||
weekends: false,
|
//weekends: false,
|
||||||
//defaultView: 'agendaWeek',
|
//defaultView: 'agendaWeek',
|
||||||
|
|
||||||
header: {
|
header: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue