diff --git a/src/Calendar.js b/src/Calendar.js index 7271b60..d32595b 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -114,7 +114,7 @@ function Calendar(element, options, eventSources) { $(window).unbind('resize', windowResize); header.destroy(); content.remove(); - element.removeClass('fc fc-rtl fc-ui-widget'); + element.removeClass('fc fc-rtl ui-widget'); } diff --git a/src/EventManager.js b/src/EventManager.js index b911830..4d159ab 100644 --- a/src/EventManager.js +++ b/src/EventManager.js @@ -4,11 +4,12 @@ fc.sourceFetchers = []; var ajaxDefaults = { dataType: 'json', - cache: true // because we are using the cacheParam option (TODO: deprecate) + cache: false }; var eventGUID = 1; + function EventManager(options, _sources) { var t = this; @@ -74,8 +75,8 @@ function EventManager(options, _sources) { if (fetchID == currentFetchID) { if (events) { for (var i=0; i "; for (i=0; i"; + ""; // fc- needed for setDayID } s += " " + @@ -190,7 +190,7 @@ function AgendaView(element, calendar, viewName) { " "; for (i=0; i" + + "" + // fc- needed for setDayID "
" + "
" + "
 
" + @@ -434,7 +434,7 @@ function AgendaView(element, calendar, viewName) { 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 date = colDate(col); var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data @@ -702,9 +702,8 @@ function AgendaView(element, calendar, viewName) { title: '', start: startDate, end: endDate, - className: [], - editable: false, - source: {} + className: ['fc-select-helper'], + editable: false }, rect )); diff --git a/src/agenda/agenda.css b/src/agenda/agenda.css index 0685fd3..21a91ae 100644 --- a/src/agenda/agenda.css +++ b/src/agenda/agenda.css @@ -118,7 +118,8 @@ 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 */ } diff --git a/src/basic/BasicView.js b/src/basic/BasicView.js index 1a8b65d..9e08f6d 100644 --- a/src/basic/BasicView.js +++ b/src/basic/BasicView.js @@ -129,7 +129,7 @@ function BasicView(element, calendar, viewName) { ""; for (i=0; i"; + ""; // need fc- for setDayID } s += "" + @@ -140,7 +140,7 @@ function BasicView(element, calendar, viewName) { ""; for (j=0; j" + + "" + // need fc- for setDayID "
" + (showNumbers ? "
" : @@ -182,14 +182,14 @@ function BasicView(element, calendar, viewName) { 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 today = clearTime(new Date()); var cell; var date; var row; - if (!optimize) { + if (dowDirty) { headCells.each(function(i, _cell) { cell = $(_cell); date = indexDate(i); @@ -212,7 +212,7 @@ function BasicView(element, calendar, viewName) { cell.removeClass(tm + '-state-highlight fc-today'); } cell.find('div.fc-day-number').text(date.getDate()); - if (!optimize) { + if (dowDirty) { setDayID(cell, date); } }); @@ -282,7 +282,7 @@ function BasicView(element, calendar, viewName) { 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 date = indexDate(index); trigger('dayClick', this, date, true, ev); diff --git a/src/common/DayEventRenderer.js b/src/common/DayEventRenderer.js index 190d628..1575a4e 100644 --- a/src/common/DayEventRenderer.js +++ b/src/common/DayEventRenderer.js @@ -126,7 +126,8 @@ function DayEventRenderer() { var bounds = allDayBounds(); var minLeft = bounds.left; 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 right; var skinCss; @@ -146,10 +147,10 @@ function DayEventRenderer() { if (seg.isEnd) { classes.push('fc-corner-left'); } - cols[0] = dayOfWeekCol(seg.end.getDay()-1); - cols[1] = dayOfWeekCol(seg.start.getDay()); - left = seg.isEnd ? colContentLeft(cols[0]) : minLeft; - right = seg.isStart ? colContentRight(cols[1]) : maxLeft; + leftCol = dayOfWeekCol(seg.end.getDay()-1); + rightCol = dayOfWeekCol(seg.start.getDay()); + left = seg.isEnd ? colContentLeft(leftCol) : minLeft; + right = seg.isStart ? colContentRight(rightCol) : maxLeft; }else{ if (seg.isStart) { classes.push('fc-corner-left'); @@ -157,12 +158,15 @@ function DayEventRenderer() { if (seg.isEnd) { classes.push('fc-corner-right'); } - cols[0] = dayOfWeekCol(seg.start.getDay()); - cols[1] = dayOfWeekCol(seg.end.getDay()-1); - left = seg.isStart ? colContentLeft(cols[0]) : minLeft; - right = seg.isEnd ? colContentRight(cols[1]) : maxLeft; + leftCol = dayOfWeekCol(seg.start.getDay()); + rightCol = dayOfWeekCol(seg.end.getDay()-1); + left = seg.isStart ? colContentLeft(leftCol) : minLeft; + 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; skinCss = getSkinCss(event, opt); if (url) { @@ -197,9 +201,8 @@ function DayEventRenderer() { ""; seg.left = left; seg.outerWidth = right - left; - cols.sort(cmp); // is this still needed now that cols are always left-to-right? - seg.startCol = cols[0]; - seg.endCol = cols[1] + 1; + seg.startCol = leftCol; + seg.endCol = rightCol + 1; // needs to be exclusive } return html; } @@ -409,7 +412,7 @@ function DayEventRenderer() { var rowCnt = getRowCnt(); var colCnt = getColCnt(); var dis = rtl ? -1 : 1; - var dit = rtl ? colCnt : 0; + var dit = rtl ? colCnt-1 : 0; var elementTop = element.css('top'); var dayDelta; var helpers; diff --git a/src/common/View.js b/src/common/View.js index b9bb0e0..e245acf 100644 --- a/src/common/View.js +++ b/src/common/View.js @@ -76,7 +76,7 @@ function View(element, calendar, viewName) { function isEventEditable(event) { - return firstDefined(event.editable, event.source.editable, opt('editable')); + return firstDefined(event.editable, (event.source || {}).editable, opt('editable')); } diff --git a/src/gcal/gcal.js b/src/gcal/gcal.js index bd2ab67..55b5b10 100644 --- a/src/gcal/gcal.js +++ b/src/gcal/gcal.js @@ -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($) { @@ -11,7 +22,7 @@ var applyAll = fc.applyAll; fc.sourceNormalizers.push(function(sourceOptions) { if (sourceOptions.dataType == 'gcal' || 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'; if (sourceOptions.editable === undefined) { sourceOptions.editable = false; @@ -48,8 +59,6 @@ function transformOptions(sourceOptions, start, end) { data: data, startParam: false, endParam: false, - cacheParam: false, - cache: false, // TODO: when we remove cacheParam, we can also remove this success: function(data) { var events = []; if (data.feed.entry) { @@ -94,6 +103,7 @@ function transformOptions(sourceOptions, start, end) { } +// legacy fc.gcalFeed = function(url, sourceOptions) { return $.extend({}, sourceOptions, { url: url, dataType: 'gcal' }); }; diff --git a/src/util.js b/src/util.js index 1a6a503..b16f064 100644 --- a/src/util.js +++ b/src/util.js @@ -303,12 +303,13 @@ function markFirstLast(e) { function setDayID(cell, date) { cell.each(function(i, _cell) { _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) { - var source = event.source; + var source = event.source || {}; var eventColor = event.color; var sourceColor = source.color; var optionColor = opt('eventColor'); @@ -329,7 +330,7 @@ function getSkinCss(event, opt) { var textColor = event.textColor || source.textColor || - opt('textColor'); + opt('eventTextColor'); var statements = []; if (backgroundColor) { statements.push('background-color:' + backgroundColor); diff --git a/tests/gcal.html b/tests/gcal.html index 4fdda1f..83be1bf 100644 --- a/tests/gcal.html +++ b/tests/gcal.html @@ -13,22 +13,27 @@ center: 'title', right: 'month,agendaWeek,basicWeek,agendaDay,basicDay' }, - editable: true, + //editable: true, eventSources: [ + { + url: "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic", + editable: true, + className: 'holiday' + }, + /* $.fullCalendar.gcalFeed( "http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic", { 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 - { - editable: true, - currentTimezone: 'America/Edmonton' // 'America/Los_Angeles' 'America/Los Angeles' - } - ) + */ + { + url: "https://www.google.com/calendar/feeds/ht3jlfaac5lfd6263ulfh4tql8%40group.calendar.google.com/public/basic", + currentTimezone: 'America/Edmonton', // 'America/Los_Angeles' 'America/Los Angeles' + editable: true + } ], eventClick: function(event) { console.log(event.start); @@ -41,12 +46,8 @@ diff --git a/tests/iframe.html b/tests/iframe.html index 07cfde6..a115e33 100644 --- a/tests/iframe.html +++ b/tests/iframe.html @@ -2,7 +2,7 @@ - + diff --git a/tests/method_destroy.html b/tests/method_destroy.html index 8094089..08438e4 100644 --- a/tests/method_destroy.html +++ b/tests/method_destroy.html @@ -11,7 +11,8 @@ left: 'prev,next today', center: 'title', right: 'month,agendaWeek,basicWeek,agendaDay,basicDay' - } + }, + theme: true }); console.log(cal.data('fullCalendar')); diff --git a/tests/methods.html b/tests/methods.html index 66a1666..1184d8e 100644 --- a/tests/methods.html +++ b/tests/methods.html @@ -96,6 +96,8 @@ event.title = "repeat yo"; //event.editable = false; event.url = "http://google.com/"; + event.color = 'red'; + event.textColor = 'green'; cal.fullCalendar('updateEvent', event); //console.log(cal.fullCalendar('clientEvents', 2)); } diff --git a/tests/options.html b/tests/options.html index 7885a45..cbb9b08 100644 --- a/tests/options.html +++ b/tests/options.html @@ -28,7 +28,7 @@ selectable: true, selectHelper: true, - weekends: false, + //weekends: false, height: 700, //contentHeight: 500, @@ -78,10 +78,18 @@ //}, //isRTL: true, + eventColor: 'green', + eventTextColor: 'yellow', + eventBorderColor: 'black', + //eventBackgroundColor: 'red', events: [ { 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', diff --git a/tests/sources.html b/tests/sources.html index 9725873..d3c6129 100644 --- a/tests/sources.html +++ b/tests/sources.html @@ -69,7 +69,7 @@ start: new Date(y, m, d, 12, 0), end: new Date(y, m, d, 14, 0), allDay: false, - //className: 'yellow-event black-text-event', + //className: 'yellow-event black-text-event' className: ['yellow-event', 'black-text-event'] }, { @@ -132,8 +132,7 @@ /* , startParam: 'mystart', - endParam: 'myend', - cacheParam: 'uniq' + endParam: 'myend' */ }); }); @@ -141,16 +140,19 @@