1.4, getting there, still need testing+docs

This commit is contained in:
Adam Shaw 2009-10-12 06:35:33 +00:00
parent 20208deb66
commit 13f7d167b3
19 changed files with 475 additions and 528 deletions

View file

@ -4,12 +4,14 @@
<!--<src>--> <!--<src>-->
<link rel='stylesheet' type='text/css' href='../src/css/main.css' /> <link rel='stylesheet' type='text/css' href='../src/css/main.css' />
<link rel='stylesheet' type='text/css' href='../src/css/grid.css' /> <link rel='stylesheet' type='text/css' href='../src/css/grid.css' />
<link rel='stylesheet' type='text/css' href='../src/css/agenda.css' />
<script type='text/javascript' src='../src/jquery/jquery.js'></script> <script type='text/javascript' src='../src/jquery/jquery.js'></script>
<script type='text/javascript' src='../src/jquery/ui.core.js'></script> <script type='text/javascript' src='../src/jquery/ui.core.js'></script>
<script type='text/javascript' src='../src/jquery/ui.draggable.js'></script> <script type='text/javascript' src='../src/jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../src/jquery/ui.resizable.js'></script> <script type='text/javascript' src='../src/jquery/ui.resizable.js'></script>
<script type='text/javascript' src='../src/main.js'></script> <script type='text/javascript' src='../src/main.js'></script>
<script type='text/javascript' src='../src/grid.js'></script> <script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script> <script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/util.js'></script> <script type='text/javascript' src='../src/util.js'></script>
<!--</src>--> <!--</src>-->

View file

@ -4,9 +4,11 @@
<!--<src>--> <!--<src>-->
<link rel='stylesheet' type='text/css' href='../src/css/main.css' /> <link rel='stylesheet' type='text/css' href='../src/css/main.css' />
<link rel='stylesheet' type='text/css' href='../src/css/grid.css' /> <link rel='stylesheet' type='text/css' href='../src/css/grid.css' />
<link rel='stylesheet' type='text/css' href='../src/css/agenda.css' />
<script type='text/javascript' src='../src/jquery/jquery.js'></script> <script type='text/javascript' src='../src/jquery/jquery.js'></script>
<script type='text/javascript' src='../src/main.js'></script> <script type='text/javascript' src='../src/main.js'></script>
<script type='text/javascript' src='../src/grid.js'></script> <script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script> <script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/util.js'></script> <script type='text/javascript' src='../src/util.js'></script>
<script type='text/javascript' src='../src/gcal.js'></script> <script type='text/javascript' src='../src/gcal.js'></script>

View file

@ -4,12 +4,14 @@
<!--<src>--> <!--<src>-->
<link rel='stylesheet' type='text/css' href='../src/css/main.css' /> <link rel='stylesheet' type='text/css' href='../src/css/main.css' />
<link rel='stylesheet' type='text/css' href='../src/css/grid.css' /> <link rel='stylesheet' type='text/css' href='../src/css/grid.css' />
<link rel='stylesheet' type='text/css' href='../src/css/agenda.css' />
<script type='text/javascript' src='../src/jquery/jquery.js'></script> <script type='text/javascript' src='../src/jquery/jquery.js'></script>
<script type='text/javascript' src='../src/jquery/ui.core.js'></script> <script type='text/javascript' src='../src/jquery/ui.core.js'></script>
<script type='text/javascript' src='../src/jquery/ui.draggable.js'></script> <script type='text/javascript' src='../src/jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../src/jquery/ui.resizable.js'></script> <script type='text/javascript' src='../src/jquery/ui.resizable.js'></script>
<script type='text/javascript' src='../src/main.js'></script> <script type='text/javascript' src='../src/main.js'></script>
<script type='text/javascript' src='../src/grid.js'></script> <script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script> <script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/util.js'></script> <script type='text/javascript' src='../src/util.js'></script>
<!--</src>--> <!--</src>-->

View file

@ -5,12 +5,14 @@
<!--<src>--> <!--<src>-->
<link rel='stylesheet' type='text/css' href='../src/css/main.css' /> <link rel='stylesheet' type='text/css' href='../src/css/main.css' />
<link rel='stylesheet' type='text/css' href='../src/css/grid.css' /> <link rel='stylesheet' type='text/css' href='../src/css/grid.css' />
<link rel='stylesheet' type='text/css' href='../src/css/agenda.css' />
<script type='text/javascript' src='../src/jquery/jquery.js'></script> <script type='text/javascript' src='../src/jquery/jquery.js'></script>
<script type='text/javascript' src='../src/jquery/ui.core.js'></script> <script type='text/javascript' src='../src/jquery/ui.core.js'></script>
<script type='text/javascript' src='../src/jquery/ui.draggable.js'></script> <script type='text/javascript' src='../src/jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../src/jquery/ui.resizable.js'></script> <script type='text/javascript' src='../src/jquery/ui.resizable.js'></script>
<script type='text/javascript' src='../src/main.js'></script> <script type='text/javascript' src='../src/main.js'></script>
<script type='text/javascript' src='../src/grid.js'></script> <script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script> <script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/util.js'></script> <script type='text/javascript' src='../src/util.js'></script>
<!--</src>--> <!--</src>-->
@ -35,11 +37,6 @@
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
theme: true, theme: true,
editable: true, editable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
events: [ events: [
{ {
id: 1, id: 1,

View file

@ -4,12 +4,14 @@
<!--<src>--> <!--<src>-->
<link rel='stylesheet' type='text/css' href='../src/css/main.css' /> <link rel='stylesheet' type='text/css' href='../src/css/main.css' />
<link rel='stylesheet' type='text/css' href='../src/css/grid.css' /> <link rel='stylesheet' type='text/css' href='../src/css/grid.css' />
<link rel='stylesheet' type='text/css' href='../src/css/agenda.css' />
<script type='text/javascript' src='../src/jquery/jquery.js'></script> <script type='text/javascript' src='../src/jquery/jquery.js'></script>
<script type='text/javascript' src='../src/jquery/ui.core.js'></script> <script type='text/javascript' src='../src/jquery/ui.core.js'></script>
<script type='text/javascript' src='../src/jquery/ui.draggable.js'></script> <script type='text/javascript' src='../src/jquery/ui.draggable.js'></script>
<script type='text/javascript' src='../src/jquery/ui.resizable.js'></script> <script type='text/javascript' src='../src/jquery/ui.resizable.js'></script>
<script type='text/javascript' src='../src/main.js'></script> <script type='text/javascript' src='../src/main.js'></script>
<script type='text/javascript' src='../src/grid.js'></script> <script type='text/javascript' src='../src/grid.js'></script>
<script type='text/javascript' src='../src/agenda.js'></script>
<script type='text/javascript' src='../src/view.js'></script> <script type='text/javascript' src='../src/view.js'></script>
<script type='text/javascript' src='../src/util.js'></script> <script type='text/javascript' src='../src/util.js'></script>
<!--</src>--> <!--</src>-->
@ -34,9 +36,15 @@
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
editable: true, editable: true,
header: { header: {
left: 'prev,next today', left: 'title',
center: 'title', center: 'month,agendaWeek,basicWeek,agendaDay,basicDay',
right: 'month,basicWeek,basicDay' right: 'today prev,next'
},
buttonText: {
agendaWeek: 'agendaWeek',
basicWeek: 'basicWeek',
agendaDay: 'agendaDay',
basicDay: 'basicDay'
}, },
events: [ events: [
{ {
@ -85,7 +93,6 @@
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif; font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
text-align: left;
} }
#calendar { #calendar {

View file

@ -1,18 +1,14 @@
// todo: scrolling
// todo: check all other options
// cleanup CSS
// optimize moveEvent/resizeEvent, to return revert function
/* Agenda Views: agendaWeek/agendaDay /* Agenda Views: agendaWeek/agendaDay
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
setDefaults({ setDefaults({
allDayHeader: true, allDayHeader: true,
allDayText: 'all-day',
slotMinutes: 30, slotMinutes: 30,
defaultEventMinutes: 120, defaultEventMinutes: 120,
axisFormat: 'htt', defaultScrollHour: 6,
axisFormat: 'h(:mm)tt',
timeFormat: { timeFormat: {
agenda: 'h:mm{ - h:mm}' agenda: 'h:mm{ - h:mm}'
}, },
@ -119,6 +115,7 @@ function Agenda(element, options, methods) {
var d0 = rtl ? addDays(cloneDate(view.visEnd), -1) : cloneDate(view.visStart), var d0 = rtl ? addDays(cloneDate(view.visEnd), -1) : cloneDate(view.visStart),
d = cloneDate(d0), d = cloneDate(d0),
scrollDate = cloneDate(d0),
today = clearTime(new Date()); today = clearTime(new Date());
if (!head) { // first time rendering, build from scratch if (!head) { // first time rendering, build from scratch
@ -143,7 +140,7 @@ function Agenda(element, options, methods) {
s+= "<th class='" + tm + "-state-default'>&nbsp;</th></tr>"; s+= "<th class='" + tm + "-state-default'>&nbsp;</th></tr>";
if (options.allDayHeader) { if (options.allDayHeader) {
s+= "<tr class='fc-all-day'>" + s+= "<tr class='fc-all-day'>" +
"<th class='fc-axis fc-leftmost " + tm + "-state-default'>all day</th>" + "<th class='fc-axis fc-leftmost " + tm + "-state-default'>" + options.allDayText + "</th>" +
"<td colspan='" + colCnt + "' class='" + tm + "-state-default'>" + "<td colspan='" + colCnt + "' class='" + tm + "-state-default'>" +
"<div class='fc-day-content'><div>&nbsp;</div></div></td>" + "<div class='fc-day-content'><div>&nbsp;</div></div></td>" +
"<th class='" + tm + "-state-default'>&nbsp;</th>" + "<th class='" + tm + "-state-default'>&nbsp;</th>" +
@ -222,6 +219,10 @@ function Agenda(element, options, methods) {
} }
updateSize(); updateSize();
scrollDate.setHours(options.defaultScrollHour);
body.scrollTop(timePosition(d0, scrollDate) + 1); // +1 for the border
fetchEvents(renderEvents); fetchEvents(renderEvents);
}; };
@ -350,18 +351,19 @@ function Agenda(element, options, methods) {
levelHeight, levelHeight,
j, seg, j, seg,
event, event,
eventClasses, className,
leftDay, leftRounded, leftDay, leftRounded,
rightDay, rightRounded, rightDay, rightRounded,
left, right, left, right,
eventElement, anchorElement; eventElement, anchorElement,
triggerRes;
for (i=0; i<len; i++) { for (i=0; i<len; i++) {
level = segRow[i]; level = segRow[i];
levelHeight = 0; levelHeight = 0;
for (j=0; j<level.length; j++) { for (j=0; j<level.length; j++) {
seg = level[j]; seg = level[j];
event = seg.event; event = seg.event;
eventClasses = ['fc-event', 'fc-event-hori']; className = 'fc-event fc-event-hori ';
if (rtl) { if (rtl) {
leftDay = seg.end.getDay() - 1; leftDay = seg.end.getDay() - 1;
leftRounded = seg.isEnd; leftRounded = seg.isEnd;
@ -374,36 +376,49 @@ function Agenda(element, options, methods) {
rightRounded = seg.isEnd; rightRounded = seg.isEnd;
} }
if (leftRounded) { if (leftRounded) {
eventClasses.push('fc-corner-left'); className += 'fc-corner-left ';
left = bg.find('td:eq('+(((leftDay-firstDay+colCnt)%colCnt)*dis+dit)+') div div').position().left + timeWidth; left = bg.find('td:eq('+(((leftDay-firstDay+colCnt)%colCnt)*dis+dit)+') div div').position().left + timeWidth;
}else{ }else{
left = timeWidth; left = timeWidth;
} }
if (rightRounded) { if (rightRounded) {
eventClasses.push('fc-corner-right'); className += 'fc-corner-right ';
right = bg.find('td:eq('+(((rightDay-firstDay+colCnt)%colCnt)*dis+dit)+') div div'); right = bg.find('td:eq('+(((rightDay-firstDay+colCnt)%colCnt)*dis+dit)+') div div');
right = right.position().left + right.width() + timeWidth; right = right.position().left + right.width() + timeWidth;
}else{ }else{
right = timeWidth + bg.width(); right = timeWidth + bg.width();
} }
eventElement = $("<div class='" + eventClasses.join(' ') + "'/>") eventElement = $("<div class='" + className + event.className.join(' ') + "'/>")
.append(anchorElement = $("<a/>") .append(anchorElement = $("<a/>")
.append($("<span class='fc-event-title' />") .append($("<span class='fc-event-title' />")
.text(event.title))) .text(event.title)));
.css({ if (event.url) {
position: 'absolute', anchorElement.attr('href', event.url);
top: top, }
left: left, triggerRes = view.trigger('eventRender', event, event, eventElement);
zIndex: 8 if (triggerRes !== false) {
}) if (triggerRes && typeof triggerRes != 'boolean') {
.appendTo(head); eventElement = $(triggerRes);
setOuterWidth(eventElement, right-left, true); }
if (seg.isEnd) { eventElement
view.resizableDayEvent(event, eventElement, colWidth); .css({
position: 'absolute',
top: top,
left: left,
zIndex: 8
})
.appendTo(head);
setOuterWidth(eventElement, right-left, true);
view.eventElementHandlers(event, eventElement);
if (event.editable || event.editable == undefined && options.editable) {
draggableDayEvent(event, eventElement, seg.isStart);
if (seg.isEnd) {
view.resizableDayEvent(event, eventElement, colWidth);
}
}
view.reportEventElement(event, eventElement);
levelHeight = Math.max(levelHeight, eventElement.outerHeight(true));
} }
draggableDayEvent(event, eventElement, seg.isStart);
view.reportEventElement(event, eventElement);
levelHeight = Math.max(levelHeight, eventElement.outerHeight(true));
} }
top += levelHeight; top += levelHeight;
rowHeight += levelHeight; rowHeight += levelHeight;
@ -426,7 +441,9 @@ function Agenda(element, options, methods) {
top, bottom, top, bottom,
tdInner, tdInner,
width, left, width, left,
eventElement, anchorElement, timeElement, titleElement; className,
eventElement, anchorElement, timeElement, titleElement,
triggerRes;
for (colI=0; colI<colLen; colI++) { for (colI=0; colI<colLen; colI++) {
col = segCols[colI]; col = segCols[colI];
for (levelI=0; levelI<col.length; levelI++) { for (levelI=0; levelI<col.length; levelI++) {
@ -454,22 +471,18 @@ function Agenda(element, options, methods) {
left = timeWidth + tdInner.position().left + // leftmost possible left = timeWidth + tdInner.position().left + // leftmost possible
(availWidth / (levelI + forward + 1) * levelI) // indentation (availWidth / (levelI + forward + 1) * levelI) // indentation
* dis + (rtl ? availWidth - width : 0); // rtl * dis + (rtl ? availWidth - width : 0); // rtl
eventElement = $("<div class='fc-event fc-event-vert' />") className = 'fc-event fc-event-vert ';
if (seg.isStart) {
className += 'fc-corner-top ';
}
if (seg.isEnd) {
className += 'fc-corner-bottom ';
}
eventElement = $("<div class='" + className + event.className.join(' ') + "' />")
.append(anchorElement = $("<a><span class='fc-event-bg'/></a>") .append(anchorElement = $("<a><span class='fc-event-bg'/></a>")
.append(titleElement = $("<span class='fc-event-title'/>") .append(titleElement = $("<span class='fc-event-title'/>")
.text(event.title))) .text(event.title)))
.css({
position: 'absolute',
zIndex: 8,
top: top,
left: left
})
.appendTo(bodyContent);
if (event.url) {
anchorElement.attr('href', event.url);
}
if (seg.isStart) { if (seg.isStart) {
eventElement.addClass('fc-corner-top');
// add the time header // add the time header
anchorElement anchorElement
.prepend(timeElement = $("<span class='fc-event-time'/>") .prepend(timeElement = $("<span class='fc-event-time'/>")
@ -477,18 +490,37 @@ function Agenda(element, options, methods) {
}else{ }else{
timeElement = null; timeElement = null;
} }
if (seg.isEnd) { if (event.url) {
eventElement.addClass('fc-corner-bottom'); anchorElement.attr('href', event.url);
resizableSlotEvent(event, eventElement, timeElement);
} }
setOuterWidth(eventElement, width, true); triggerRes = view.trigger('eventRender', event, event, eventElement);
setOuterHeight(eventElement, bottom-top, true); if (triggerRes !== false) {
if (timeElement && eventElement.height() - titleElement.position().top < 10) { if (triggerRes && typeof triggerRes != 'boolean') {
// event title doesn't have enough room, put next to the time eventElement = $(triggerRes);
timeElement.text(formatDate(event.start, view.option('timeFormat')) + ' - ' + event.title); }
titleElement.remove(); eventElement
.css({
position: 'absolute',
zIndex: 8,
top: top,
left: left
})
.appendTo(bodyContent);
setOuterWidth(eventElement, width, true);
setOuterHeight(eventElement, bottom-top, true);
if (timeElement && eventElement.height() - titleElement.position().top < 10) {
// event title doesn't have enough room, put next to the time
timeElement.text(formatDate(event.start, view.option('timeFormat')) + ' - ' + event.title);
titleElement.remove();
}
view.eventElementHandlers(event, eventElement);
if (event.editable || event.editable == undefined && options.editable) {
draggableSlotEvent(event, eventElement, timeElement);
if (seg.isEnd) {
resizableSlotEvent(event, eventElement, timeElement);
}
}
} }
draggableSlotEvent(event, eventElement, timeElement);
view.reportEventElement(event, eventElement); view.reportEventElement(event, eventElement);
} }
} }
@ -506,84 +538,90 @@ function Agenda(element, options, methods) {
// when event starts out FULL-DAY // when event starts out FULL-DAY
function draggableDayEvent(event, eventElement, isStart) { function draggableDayEvent(event, eventElement, isStart) {
var origPosition, origWidth, if (!options.disableDragging && eventElement.draggable) {
resetElement, var origPosition, origWidth,
allDay=true, resetElement,
matrix; allDay=true,
eventElement.draggable({ matrix;
zIndex: 9, eventElement.draggable({
opacity: view.option('month'), // use whatever the month view was using zIndex: 9,
start: function(ev) { opacity: view.option('dragOpacity', 'month'), // use whatever the month view was using
origPosition = eventElement.position(); revertDuration: options.dragRevertDuration,
origWidth = eventElement.width(); start: function(ev, ui) {
resetElement = function() { view.hideEvents(event, eventElement);
if (!allDay) { view.trigger('eventDragStart', eventElement, event, ev, ui);
eventElement origPosition = eventElement.position();
.width(origWidth) origWidth = eventElement.width();
.height('') resetElement = function() {
.draggable('option', 'grid', null); if (!allDay) {
allDay = true; eventElement
} .width(origWidth)
}; .height('')
matrix = new HoverMatrix(function(cell) { .draggable('option', 'grid', null);
eventElement.draggable('option', 'revert', !cell || !cell.rowDelta && !cell.colDelta); allDay = true;
if (cell) { }
if (!cell.row) { // on full-days };
resetElement(); matrix = new HoverMatrix(function(cell) {
view.showOverlay(cell); eventElement.draggable('option', 'revert', !cell || !cell.rowDelta && !cell.colDelta);
}else{ // mouse is over bottom slots if (cell) {
if (isStart && allDay) { if (!cell.row) { // on full-days
// convert event to temporary slot-event resetElement();
setOuterHeight( view.showOverlay(cell);
eventElement.width(colWidth - 10), // don't use entire width }else{ // mouse is over bottom slots
rowHeight * Math.round( if (isStart && allDay) {
(event.end ? ((event.end - event.start)/MINUTE_MS) : options.defaultEventMinutes) // convert event to temporary slot-event
/options.slotMinutes) setOuterHeight(
); eventElement.width(colWidth - 10), // don't use entire width
eventElement.draggable('option', 'grid', [colWidth, 1]); rowHeight * Math.round(
allDay = false; (event.end ? ((event.end - event.start)/MINUTE_MS) : options.defaultEventMinutes)
/options.slotMinutes)
);
eventElement.draggable('option', 'grid', [colWidth, 1]);
allDay = false;
}
view.hideOverlay();
} }
}else{ // mouse is outside of everything
view.hideOverlay(); view.hideOverlay();
} }
}else{ // mouse is outside of everything });
view.hideOverlay(); matrix.row(head.find('td'));
bg.find('td').each(function() {
matrix.col(this);
});
matrix.row(body);
matrix.mouse(ev.pageX, ev.pageY);
},
drag: function(ev, ui) {
matrix.mouse(ev.pageX, ev.pageY);
},
stop: function(ev, ui) {
view.hideOverlay();
view.trigger('eventDragStop', eventElement, event, ev, ui);
var cell = matrix.cell,
dayDelta = dis * (
allDay ? // can't trust cell.colDelta when using slot grid
(cell ? cell.colDelta : 0) :
Math.floor((ui.position.left - origPosition.left) / colWidth)
);
if (!cell || !dayDelta && !cell.rowDelta) {
// over nothing (has reverted)
resetElement();
view.showEvents(event, eventElement);
}else{
//eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
view.eventDrop(
this, event, dayDelta,
allDay ? 0 : // minute delta
Math.round((eventElement.offset().top - bodyContent.offset().top) / rowHeight)
* options.slotMinutes
- (event.start.getHours() * 60 + event.start.getMinutes()),
allDay, ev, ui
);
} }
});
view.hideEvents(event, eventElement);
matrix.row(head.find('td'));
bg.find('td').each(function() {
matrix.col(this);
});
matrix.row(body);
matrix.mouse(ev.pageX, ev.pageY);
},
drag: function(ev, ui) {
matrix.mouse(ev.pageX, ev.pageY);
},
stop: function(ev, ui) {
view.hideOverlay();
var cell = matrix.cell,
dayDelta = dis * (
allDay ? // can't trust cell.colDelta when using slot grid
(cell ? cell.colDelta : 0) :
Math.floor((ui.position.left - origPosition.left) / colWidth)
);
if (!cell || !dayDelta && !cell.rowDelta) {
// over nothing (has reverted)
resetElement();
view.showEvents(event, eventElement);
}else{
view.eventDrop(
this, event, dayDelta,
allDay ? 0 : // minute delta
Math.round((eventElement.offset().top - bodyContent.offset().top) / rowHeight)
* options.slotMinutes
- (event.start.getHours() * 60 + event.start.getMinutes()),
allDay, ev, ui
);
} }
} });
}); }
} }
@ -591,108 +629,113 @@ function Agenda(element, options, methods) {
// when event starts out IN TIMESLOTS // when event starts out IN TIMESLOTS
function draggableSlotEvent(event, eventElement, timeElement) { function draggableSlotEvent(event, eventElement, timeElement) {
var origPosition, if (!options.disableDragging && eventElement.draggable) {
resetElement, var origPosition,
prevSlotDelta, slotDelta, resetElement,
allDay=false, prevSlotDelta, slotDelta,
matrix; allDay=false,
eventElement.draggable({ matrix;
zIndex: 9, eventElement.draggable({
scroll: false, zIndex: 9,
grid: [colWidth, rowHeight], scroll: false,
axis: colCnt==1 ? 'y' : false, grid: [colWidth, rowHeight],
opacity: view.option('dragOpacity'), axis: colCnt==1 ? 'y' : false,
start: function(ev, ui) { opacity: view.option('dragOpacity'),
if ($.browser.msie) { revertDuration: options.dragRevertDuration,
eventElement.find('span.fc-event-bg').hide(); // nested opacities mess up in IE, just hide start: function(ev, ui) {
} view.hideEvents(event, eventElement);
origPosition = eventElement.position(); view.trigger('eventDragStart', eventElement, event, ev, ui);
resetElement = function() { if ($.browser.msie) {
// convert back to original slot-event eventElement.find('span.fc-event-bg').hide(); // nested opacities mess up in IE, just hide
if (allDay) {
if (timeElement) {
timeElement.css('display', ''); // show() was causing display=inline
}
eventElement.draggable('option', 'grid', [colWidth, rowHeight]);
allDay = false;
} }
}; origPosition = eventElement.position();
prevSlotDelta = 0; resetElement = function() {
matrix = new HoverMatrix(function(cell) { // convert back to original slot-event
eventElement.draggable('option', 'revert', !cell); if (allDay) {
if (cell) { if (timeElement) {
if (!cell.row && options.allDayHeader) { // over full days timeElement.css('display', ''); // show() was causing display=inline
if (!allDay) {
// convert to temporary all-day event
allDay = true;
if (timeElement) {
timeElement.hide();
}
eventElement.draggable('option', 'grid', null);
} }
view.showOverlay(cell); eventElement.draggable('option', 'grid', [colWidth, rowHeight]);
}else{ // on slots allDay = false;
resetElement(); }
};
prevSlotDelta = 0;
matrix = new HoverMatrix(function(cell) {
eventElement.draggable('option', 'revert', !cell);
if (cell) {
if (!cell.row && options.allDayHeader) { // over full days
if (!allDay) {
// convert to temporary all-day event
allDay = true;
if (timeElement) {
timeElement.hide();
}
eventElement.draggable('option', 'grid', null);
}
view.showOverlay(cell);
}else{ // on slots
resetElement();
view.hideOverlay();
}
}else{
view.hideOverlay(); view.hideOverlay();
} }
}else{ });
view.hideOverlay(); if (options.allDayHeader) {
matrix.row(head.find('td'));
} }
}); bg.find('td').each(function() {
if (options.allDayHeader) { matrix.col(this);
matrix.row(head.find('td')); });
} matrix.row(body);
bg.find('td').each(function() { matrix.mouse(ev.pageX, ev.pageY);
matrix.col(this); },
}); drag: function(ev, ui) {
matrix.row(body); slotDelta = Math.round((ui.position.top - origPosition.top) / rowHeight);
matrix.mouse(ev.pageX, ev.pageY); if (slotDelta != prevSlotDelta) {
view.hideEvents(event, eventElement); if (timeElement && !allDay) {
}, // update time header
drag: function(ev, ui) { var minuteDelta = slotDelta*options.slotMinutes,
slotDelta = Math.round((ui.position.top - origPosition.top) / rowHeight); newStart = addMinutes(cloneDate(event.start), minuteDelta),
if (slotDelta != prevSlotDelta) { newEnd;
if (timeElement && !allDay) { if (event.end) {
// update time header newEnd = addMinutes(cloneDate(event.end), minuteDelta);
var minuteDelta = slotDelta*options.slotMinutes, }
newStart = addMinutes(cloneDate(event.start), minuteDelta), timeElement.text(formatDates(newStart, newEnd, view.option('timeFormat')));
newEnd;
if (event.end) {
newEnd = addMinutes(cloneDate(event.end), minuteDelta);
} }
timeElement.text(formatDates(newStart, newEnd, view.option('timeFormat'))); prevSlotDelta = slotDelta;
} }
prevSlotDelta = slotDelta; matrix.mouse(ev.pageX, ev.pageY);
} },
matrix.mouse(ev.pageX, ev.pageY); stop: function(ev, ui) {
}, view.hideOverlay();
stop: function(ev, ui) { view.trigger('eventDragStop', eventElement, event, ev, ui);
view.hideOverlay(); var cell = matrix.cell,
var cell = matrix.cell, dayDelta = dis * (
dayDelta = dis * ( allDay ? // can't trust cell.colDelta when using slot grid
allDay ? // can't trust cell.colDelta when using slot grid (cell ? cell.colDelta : 0) :
(cell ? cell.colDelta : 0) : Math.floor((ui.position.left - origPosition.left) / colWidth)
Math.floor((ui.position.left - origPosition.left) / colWidth) );
); if (!cell || !slotDelta && !dayDelta) {
if (!cell || !slotDelta && !dayDelta) { resetElement();
resetElement(); if ($.browser.msie) {
if ($.browser.msie) { eventElement
eventElement .css('filter', '') // clear IE opacity side-effects
.css('filter', '') // clear IE opacity side-effects .find('span.fc-event-bg').css('display', ''); // .show() made display=inline
.find('span.fc-event-bg').css('display', ''); // .show() made display=inline }
eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
view.showEvents(event, eventElement);
}else{
//TODO: eventElement.find('a').removeAttr('href'); // prevents safari from visiting the link
view.eventDrop(
this, event, dayDelta,
allDay ? 0 : slotDelta * options.slotMinutes, // minute delta
allDay, ev, ui
);
} }
eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
view.showEvents(event, eventElement);
}else{
view.eventDrop(
this, event, dayDelta,
allDay ? 0 : slotDelta * options.slotMinutes, // minute delta
allDay, ev, ui
);
} }
} });
}); }
} }
@ -704,47 +747,51 @@ function Agenda(element, options, methods) {
// for TIMESLOT events // for TIMESLOT events
function resizableSlotEvent(event, eventElement, timeElement) { function resizableSlotEvent(event, eventElement, timeElement) {
var slotDelta, prevSlotDelta; if (!options.disableResizing && eventElement.resizable) {
eventElement var slotDelta, prevSlotDelta;
.resizable({ eventElement
handles: 's', .resizable({
grid: rowHeight, handles: 's',
start: function() { grid: rowHeight,
slotDelta = prevSlotDelta = 0; start: function(ev, ui) {
view.hideEvents(event, eventElement); slotDelta = prevSlotDelta = 0;
if ($.browser.msie && $.browser.version == '6.0') { view.hideEvents(event, eventElement);
eventElement.css('overflow', 'hidden'); if ($.browser.msie && $.browser.version == '6.0') {
} eventElement.css('overflow', 'hidden');
eventElement.css('z-index', 9); }
}, eventElement.css('z-index', 9);
resize: function(ev, ui) { view.trigger('eventResizeStart', this, event, ev, ui);
// don't rely on ui.size.height, doesn't take grid into account },
slotDelta = Math.round((Math.max(rowHeight, eventElement.height()) - ui.originalSize.height) / rowHeight); resize: function(ev, ui) {
if (slotDelta != prevSlotDelta) { // don't rely on ui.size.height, doesn't take grid into account
if (timeElement) { slotDelta = Math.round((Math.max(rowHeight, eventElement.height()) - ui.originalSize.height) / rowHeight);
timeElement.text( if (slotDelta != prevSlotDelta) {
formatDates( if (timeElement) {
event.start, timeElement.text(
(!slotDelta && !event.end) ? null : // no change, so don't display time range formatDates(
addMinutes(view.eventEnd(event), options.slotMinutes*slotDelta), event.start,
view.option('timeFormat') (!slotDelta && !event.end) ? null : // no change, so don't display time range
) addMinutes(view.eventEnd(event), options.slotMinutes*slotDelta),
); view.option('timeFormat')
)
);
}
prevSlotDelta = slotDelta;
}
},
stop: function(ev, ui) {
view.trigger('eventResizeStop', this, event, ev, ui);
if (slotDelta) {
view.eventResize(this, event, 0, options.slotMinutes*slotDelta, ev, ui);
}else{
eventElement.css('z-index', 8);
view.showEvents(event, eventElement);
// BUG: if event was really short, need to put title back in span
} }
prevSlotDelta = slotDelta;
} }
}, })
stop: function(ev, ui) { .find('div.ui-resizable-s').text('=');
if (slotDelta) { }
view.eventResize(this, event, 0, options.slotMinutes*slotDelta, ev, ui);
}else{
eventElement.css('z-index', 8);
view.showEvents(event, eventElement);
// BUG: if event was really short, need to put title back in span
}
}
})
.find('div.ui-resizable-s').text('=');
} }

View file

@ -1,33 +1,14 @@
/*.fc-event, /* Agenda Week View, Agenda Day View
.fc-event a, ------------------------------------------------------------------------*/
.fc-agenda .fc-event-time {
color: #fff;
border-style: solid;
border-color: blue;
background-color: blue;
}*/
.fc .fc-axis {
width: 50px;
padding: 0 4px 0 0;
vertical-align: middle;
white-space: nowrap;
text-align: right;
font-weight: normal;
}
.fc .fc-agenda th, .fc .fc-agenda th,
.fc .fc-agenda td { .fc .fc-agenda td {
border-width: 1px 0 0 1px; border-width: 1px 0 0 1px;
} }
.fc-agenda-head tr.fc-all-day th { .fc .fc-agenda .fc-leftmost {
height: 35px; border-left: 0;
} }
.fc-agenda tr.fc-first th, .fc-agenda tr.fc-first th,
@ -35,160 +16,68 @@
border-top: 0; border-top: 0;
} }
.fc .fc-agenda .fc-leftmost { .fc-agenda-head tr.fc-last th {
border-left: 0; border-bottom-width: 1px;
} }
.fc .fc-agenda-head td, .fc .fc-agenda-head td,
.fc .fc-agenda-body td { .fc .fc-agenda-body td {
background: none; background: none;
} }
.fc .fc-agenda-body td div { .fc-agenda-head th {
height: 20px; text-align: center;
}
.fc .fc-agenda-body tr.fc-minor th,
.fc .fc-agenda-body tr.fc-minor td {
border-top-style: dotted;
} }
/* the time axis running down the left side */
.fc-agenda .fc-axis {
width: 50px;
padding: 0 4px;
vertical-align: middle;
white-space: nowrap;
text-align: right;
font-weight: normal;
}
/* all-day event cells at top */
.fc-agenda-head tr.fc-all-day th {
height: 35px;
}
.fc-agenda-head td {
padding-bottom: 10px;
}
.fc .fc-divider div { .fc .fc-divider div {
font-size: 1px; /* for IE6/7 */ font-size: 1px; /* for IE6/7 */
height: 2px; height: 2px;
} }
.fc .fc-divider .fc-state-default { .fc .fc-divider .fc-state-default {
background: #eee; background: #eee; /* color for divider between all-day and time-slot events */
}
.fc-agenda-head tr.fc-last th {
border-bottom-width: 1px;
}
.fc-agenda .fc-day-content {
padding: 2px 2px 0;
}
.fc-agenda-head .fc-day-content {
padding-bottom: 10px;
} }
/* body styles */
.fc .fc-agenda-body td div {
height: 20px; /* slot height */
/* header styles */
/*
.fc .fc-agenda-head th.fc-first {
border-left: 0;
} }
.fc .fc-agenda-head th,
.fc .fc-agenda-head td {
border-width: 1px 0 0 1px;
}
.fc-agenda-head tr.fc-first th {
border-width: 0 0 0 1px;
}
.fc-agenda-head tr.fc-last th,
.fc-agenda-head tr.fc-last td {
border-bottom-width: 2px;
}
.fc-agenda-head tr.fc-last th {
#border-width: 1px 0 1px 1px;
background-image: none;
}
.fc-agenda-head tr.fc-last th.fc-first {
#border-width: 0 2px 1px 0;
}
.fc-agenda-head tr.fc-last th.fc-last {
#border-width: 0 0 0 3px;
}
.fc .fc-agenda-head td {
#border-width: 3px 0 3px 1px;
background: none;
}
.fc-agenda-body {
#width: 100%;
overflow: auto;
}
*/
/*
.fc .fc-agenda-body th {
border-width: 1px 0 0 0;
background-image: none;
text-align: right;
font-weight: normal;
vertical-align: middle;
width: 48px;
height: 22px;
padding-right: 2px;
}
.fc .fc-agenda-body td {
border-width: 1px 0 0 1px;
background: none;
}
.fc .fc-agenda-body tr.fc-minor th, .fc .fc-agenda-body tr.fc-minor th,
.fc .fc-agenda-body tr.fc-minor td { .fc .fc-agenda-body tr.fc-minor td {
border-top-style: dotted; border-top-style: dotted;
} }
.fc .fc-agenda-body tr.fc-first th,
.fc .fc-agenda-body tr.fc-first td {
border-top: 0;
}
.fc .fc-agenda-bg td {
border-style: double;
border-width: 0 0 0 3px;
}
.fc .fc-agenda-bg td.fc-not-today {
background: none;
}
.fc-agenda .fc-day-content { .fc-agenda .fc-day-content {
padding: 2px 1px 14px; padding: 2px 2px 0; /* distance between events and day edges */
} }
*/
/* Vertical Events
------------------------------------------------------------------------*/
/* vertical events */
.fc-event-vert { .fc-event-vert {
border-width: 0 1px; border-width: 0 1px;
@ -198,6 +87,8 @@
border-width: 0; border-width: 0;
} }
/* for fake rounded corners */
.fc-content .fc-corner-top { .fc-content .fc-corner-top {
margin-top: 1px; margin-top: 1px;
} }
@ -216,6 +107,8 @@
border-bottom-width: 1px; border-bottom-width: 1px;
} }
/* event content */
.fc-event-vert span { .fc-event-vert span {
display: block; display: block;
position: relative; position: relative;
@ -226,15 +119,15 @@
white-space: nowrap; white-space: nowrap;
_white-space: normal; _white-space: normal;
overflow: hidden; overflow: hidden;
font-size: 10px;
border: 0; border: 0;
font-size: 10px;
} }
.fc-event-vert span.fc-event-title { .fc-event-vert span.fc-event-title {
line-height: 13px; line-height: 13px;
} }
.fc-event-vert span.fc-event-bg { .fc-event-vert span.fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay */
position: absolute; position: absolute;
z-index: 1; z-index: 1;
top: 0; top: 0;
@ -243,14 +136,20 @@
height: 100%; height: 100%;
background: #fff; background: #fff;
opacity: .3; opacity: .3;
filter: alpha(opacity=30); filter: alpha(opacity=30); /* for IE */
} }
/* resizable */
.fc-event-vert .ui-resizable-s { .fc-event-vert .ui-resizable-s {
bottom: 0 !important; /* importants override pre jquery ui 1.7 styles */
width: 100% !important;
height: 8px !important;
line-height: 8px !important;
font-size: 11px !important;
font-family: monospace; font-family: monospace;
height: 8px;
font-size: 11px;
line-height: 8px;
bottom: 0;
text-align: center; text-align: center;
} cursor: s-resize;
}

View file

@ -281,7 +281,7 @@ table.fc-header {
display: block; display: block;
position: absolute; position: absolute;
z-index: 99999; z-index: 99999;
border: 0; /* important overrides pre jquery ui 1.7 styles */ border: 0 !important; /* important overrides pre jquery ui 1.7 styles */
background: url(data:image/gif;base64,AAAA) !important; /* hover fix for IE */ background: url(data:image/gif;base64,AAAA) !important; /* hover fix for IE */
} }

View file

@ -241,7 +241,7 @@ function Grid(element, options, methods) {
} }
updateSize(); updateSize(); // BUG: quirky widths with weekMode:variable
fetchEvents(renderEvents); fetchEvents(renderEvents);
}; };
@ -349,7 +349,7 @@ function Grid(element, options, methods) {
levelHeight, levelHeight,
k, seg, k, seg,
event, event,
eventClasses, className,
startElm, endElm, startElm, endElm,
left, right, left, right,
eventElement, eventAnchor, eventElement, eventAnchor,
@ -376,17 +376,7 @@ function Grid(element, options, methods) {
for (k=0; k<segs.length; k++) { for (k=0; k<segs.length; k++) {
seg = segs[k]; seg = segs[k];
event = seg.event; event = seg.event;
eventClasses = event.className; className = 'fc-event fc-event-hori ';
if (typeof eventClasses == 'object') { // an array
eventClasses = eventClasses.slice(0);
}
else if (typeof eventClasses == 'string') {
eventClasses = eventClasses.split(' ');
}
else {
eventClasses = [];
}
eventClasses.push('fc-event', 'fc-event-hori');
startElm = seg.isStart ? startElm = seg.isStart ?
tr.find('td:eq('+((seg.start.getDay()-firstDay+colCnt)%colCnt)+') div div') : tr.find('td:eq('+((seg.start.getDay()-firstDay+colCnt)%colCnt)+') div div') :
tbody; tbody;
@ -397,22 +387,22 @@ function Grid(element, options, methods) {
left = endElm.position().left; left = endElm.position().left;
right = startElm.position().left + startElm.width(); right = startElm.position().left + startElm.width();
if (seg.isStart) { if (seg.isStart) {
eventClasses.push('fc-corner-right'); className += 'fc-corner-right ';
} }
if (seg.isEnd) { if (seg.isEnd) {
eventClasses.push('fc-corner-left'); className += 'fc-corner-left ';
} }
}else{ }else{
left = startElm.position().left; left = startElm.position().left;
right = endElm.position().left + endElm.width(); right = endElm.position().left + endElm.width();
if (seg.isStart) { if (seg.isStart) {
eventClasses.push('fc-corner-left'); className += 'fc-corner-left ';
} }
if (seg.isEnd) { if (seg.isEnd) {
eventClasses.push('fc-corner-right'); className += 'fc-corner-right ';
} }
} }
eventElement = $("<div class='" + eventClasses.join(' ') + "'/>") eventElement = $("<div class='" + className + event.className.join(' ') + "'/>")
.append(eventAnchor = $("<a/>") .append(eventAnchor = $("<a/>")
.append(event.allDay || !seg.isStart ? null : .append(event.allDay || !seg.isStart ? null :
$("<span class='fc-event-time'/>") $("<span class='fc-event-time'/>")
@ -443,7 +433,7 @@ function Grid(element, options, methods) {
eventElement.css('left', left + rtlLeftDiff); eventElement.css('left', left + rtlLeftDiff);
} }
} }
eventElementHandlers(event, eventElement); view.eventElementHandlers(event, eventElement);
if (event.editable || event.editable == undefined && options.editable) { if (event.editable || event.editable == undefined && options.editable) {
draggableEvent(event, eventElement); draggableEvent(event, eventElement);
if (seg.isEnd) { if (seg.isEnd) {
@ -461,23 +451,6 @@ function Grid(element, options, methods) {
} }
} }
function eventElementHandlers(event, eventElement) {
eventElement
.click(function(ev) {
if (!eventElement.hasClass('ui-draggable-dragging')) {
return view.trigger('eventClick', this, event, ev);
}
})
.hover(
function(ev) {
view.trigger('eventMouseover', this, event, ev);
},
function(ev) {
view.trigger('eventMouseout', this, event, ev);
}
);
}
/* Event Dragging /* Event Dragging
@ -493,6 +466,8 @@ function Grid(element, options, methods) {
opacity: view.option('dragOpacity'), opacity: view.option('dragOpacity'),
revertDuration: options.dragRevertDuration, revertDuration: options.dragRevertDuration,
start: function(ev, ui) { start: function(ev, ui) {
view.hideEvents(event, eventElement);
view.trigger('eventDragStart', eventElement, event, ev, ui);
matrix = new HoverMatrix(function(cell) { matrix = new HoverMatrix(function(cell) {
eventElement.draggable('option', 'revert', !cell || !cell.rowDelta && !cell.colDelta); eventElement.draggable('option', 'revert', !cell || !cell.rowDelta && !cell.colDelta);
if (cell) { if (cell) {
@ -511,8 +486,6 @@ function Grid(element, options, methods) {
tds.each(function() { tds.each(function() {
matrix.col(this); matrix.col(this);
}); });
view.hideEvents(event, eventElement);
view.trigger('eventDragStart', eventElement, event, ev, ui);
matrix.mouse(ev.pageX, ev.pageY); matrix.mouse(ev.pageX, ev.pageY);
}, },
drag: function(ev) { drag: function(ev) {

View file

@ -12,9 +12,9 @@ var defaults = {
defaultView: 'month', defaultView: 'month',
aspectRatio: 1.35, aspectRatio: 1.35,
header: { header: {
left: 'title', left: 'prev,next today',
center: '', center: 'title',
right: 'today prev,next' right: 'month,agendaWeek,agendaDay'
}, },
// editing // editing
@ -72,9 +72,9 @@ var defaults = {
// right-to-left defaults // right-to-left defaults
var rtlDefaults = { var rtlDefaults = {
header: { header: {
left: 'next,prev today', left: 'agendaDay,agendaWeek,month',
center: '', center: 'title',
right: 'title' right: 'today next,prev'
}, },
buttonText: { buttonText: {
prev: '&nbsp;&#9658;&nbsp;', prev: '&nbsp;&#9658;&nbsp;',
@ -542,8 +542,7 @@ $.fn.fullCalendar = function(options) {
} }
var prevButton; var prevButton;
$.each(this.split(','), function(j) { $.each(this.split(','), function(j) {
var buttonName = this, var buttonName = this;
buttonNameShort = this.replace(/^(basic|agenda)/, '').toLowerCase();
if (buttonName == 'title') { if (buttonName == 'title') {
tr.append("<td><h2 class='fc-header-title'/></td>"); tr.append("<td><h2 class='fc-header-title'/></td>");
if (prevButton) { if (prevButton) {
@ -552,8 +551,8 @@ $.fn.fullCalendar = function(options) {
prevButton = null; prevButton = null;
}else{ }else{
var buttonClick; var buttonClick;
if (publicMethods[buttonNameShort]) { if (publicMethods[buttonName]) {
buttonClick = publicMethods[buttonNameShort]; buttonClick = publicMethods[buttonName];
} }
else if (views[buttonName]) { else if (views[buttonName]) {
buttonClick = function() { changeView(buttonName) }; buttonClick = function() { changeView(buttonName) };
@ -563,8 +562,8 @@ $.fn.fullCalendar = function(options) {
prevButton.addClass(tm + '-no-right'); prevButton.addClass(tm + '-no-right');
} }
var button, var button,
icon = options.theme ? options.buttonIcons[buttonNameShort] : null, icon = options.theme ? viewOption(options, 'buttonIcons', buttonName) : null,
text = options.buttonText[buttonNameShort]; text = viewOption(options, 'buttonText', buttonName);
if (icon) { if (icon) {
button = $("<div class='fc-button-" + buttonName + " ui-state-default'>" + button = $("<div class='fc-button-" + buttonName + " ui-state-default'>" +
"<a><span class='ui-icon ui-icon-" + icon + "'/></a></div>"); "<a><span class='ui-icon ui-icon-" + icon + "'/></a></div>");
@ -575,6 +574,7 @@ $.fn.fullCalendar = function(options) {
} }
if (button) { if (button) {
button button
.click(buttonClick)
.mousedown(function() { .mousedown(function() {
button.addClass(tm + '-state-down'); button.addClass(tm + '-state-down');
}) })
@ -591,14 +591,6 @@ $.fn.fullCalendar = function(options) {
} }
) )
.appendTo($("<td/>").appendTo(tr)); .appendTo($("<td/>").appendTo(tr));
if (publicMethods[buttonNameShort]) {
button.click(publicMethods[buttonNameShort]);
}
else if (views[buttonName]) {
button.click(function() {
changeView(buttonName);
});
}
if (prevButton) { if (prevButton) {
prevButton.addClass(tm + '-no-right'); prevButton.addClass(tm + '-no-right');
}else{ }else{
@ -685,6 +677,29 @@ $.fn.fullCalendar = function(options) {
// TODO: rename
function viewOption(options, property, viewName) {
var v = options[property];
if (typeof v == 'object') {
if (v[viewName] != undefined) {
return v[viewName];
}
var parts = viewName.split(/(?=[A-Z])/),
i=parts.length-1, res;
for (; i>=0; i--) {
res = v[parts[i].toLowerCase()];
if (res != undefined) {
return res;
}
}
return v[''];
}
return v;
}
/* Important Event Utilities /* Important Event Utilities
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
@ -707,5 +722,12 @@ function normalizeEvent(event, options) {
if (event.allDay == undefined) { if (event.allDay == undefined) {
event.allDay = options.allDayDefault; event.allDay = options.allDayDefault;
} }
if (event.className) {
if (typeof event.className == 'string') {
event.className = event.className.split(/\s+/);
}
}else{
event.className = [];
}
} }

View file

@ -212,7 +212,8 @@ var viewMethods = {
handles: view.options.isRTL ? 'w' : 'e', handles: view.options.isRTL ? 'w' : 'e',
grid: colWidth, grid: colWidth,
minWidth: colWidth/2, // need this or else IE throws errors when too small minWidth: colWidth/2, // need this or else IE throws errors when too small
containment: view.element, containment: view.element.parent().parent(), // the main element...
// ... a fix. wouldn't allow extending to last column in agenda views (jq ui bug?)
start: function(ev, ui) { start: function(ev, ui) {
eventElement.css('z-index', 9); eventElement.css('z-index', 9);
view.hideEvents(event, eventElement); view.hideEvents(event, eventElement);
@ -235,22 +236,33 @@ var viewMethods = {
// attaches eventClick, eventMouseover, eventMouseout
eventElementHandlers: function(event, eventElement) {
var view = this;
eventElement
.click(function(ev) {
if (!eventElement.hasClass('ui-draggable-dragging') &&
!eventElement.hasClass('ui-resizable-resizing')) {
return view.trigger('eventClick', this, event, ev);
}
})
.hover(
function(ev) {
view.trigger('eventMouseover', this, event, ev);
},
function(ev) {
view.trigger('eventMouseout', this, event, ev);
}
);
},
// get a property from the 'options' object, using smart view naming // get a property from the 'options' object, using smart view naming
option: function(name) { option: function(name, viewName) {
var v = this.options[name]; return viewOption(this.options, name, this.name || viewName);
if (typeof v == 'object') {
var parts = this.name.split(/(?=[A-Z])/),
i=parts.length-1, res;
for (; i>=0; i--) {
res = v[parts[i].toLowerCase()];
if (res != undefined) {
return res;
}
}
return v[''];
}
return v;
}, },
@ -331,7 +343,6 @@ function stackSegs(segs) {
}else{ }else{
levels[j] = [seg]; levels[j] = [seg];
} }
//seg.after = 0;
} }
return levels; return levels;
} }

View file

@ -12,20 +12,10 @@
var m = d.getMonth(); var m = d.getMonth();
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
slotMinutes: 30,
//allDayHeader: false,
//weekMode: 'variable',
//theme: true,
//firstDay: 1,
//isRTL: true,
editable: true,
//dragOpacity: .5,
defaultView: 'agendaWeek',
header: { header: {
left: 'prev,next today', right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
center: 'title',
right: 'month,agendaWeek,agendaDay'
}, },
editable: true,
events: [ events: [
{ {
id: 1, id: 1,
@ -50,7 +40,8 @@
id: 345, id: 345,
title: "Hey Hey", title: "Hey Hey",
start: new Date(y, m, 9, 4, 0), start: new Date(y, m, 9, 4, 0),
allDay: false allDay: false,
className: 'adam shaw'
}, },
{ {
id: 3, id: 3,
@ -66,10 +57,7 @@
url: "http://facebook.com/", url: "http://facebook.com/",
allDay: false allDay: false
} }
], ]
dayClick: function(date, allDay) {
alert(date + ' allDay:' + allDay);
}
}); });
}); });
@ -85,7 +73,7 @@
} }
#calendar { #calendar {
width: 80%; width: 900px;
margin: 0 auto; margin: 0 auto;
} }

View file

@ -10,6 +10,9 @@
$(document).ready(function() { $(document).ready(function() {
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
header: {
right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
},
editable: true, editable: true,
eventSources: [ eventSources: [
$.fullCalendar.gcalFeed( $.fullCalendar.gcalFeed(

View file

@ -12,7 +12,7 @@
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
header: { header: {
center: 'month,basicWeek,basicDay' left: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
}, },
editable: true, editable: true,

View file

@ -15,9 +15,7 @@
cal = $('#calendar').fullCalendar({ cal = $('#calendar').fullCalendar({
editable: true, editable: true,
header: { header: {
left: 'prev,next today', right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
center: 'title',
right: 'month,basicWeek,basicDay'
}, },
loading: function(bool) { loading: function(bool) {
if (bool) { if (bool) {

View file

@ -23,7 +23,7 @@
header: { header: {
left: 'title', left: 'title',
center: 'prev,month,basicWeek,basicDay,next', center: 'prev,month,agendaWeek,basicWeek,agendaDay,basicDay,next',
right: 'today' right: 'today'
}, },

View file

@ -86,9 +86,7 @@
cal = $('#calendar').fullCalendar({ cal = $('#calendar').fullCalendar({
editable: true, editable: true,
header: { header: {
left: 'prev,next today', right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
center: 'title',
right: 'month,basicWeek,basicDay'
}, },
//events: staticEvents, //events: staticEvents,
eventSources: [ eventSources: [

View file

@ -18,7 +18,7 @@
//isRTL: true, //isRTL: true,
header: { header: {
center: 'month,basicWeek,basicDay' right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
}, },
buttonIcons: { buttonIcons: {

View file

@ -11,9 +11,7 @@
$(document).ready(function() { $(document).ready(function() {
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
header: { header: {
left: 'prev,next today', right: 'month,agendaWeek,basicWeek,agendaDay,basicDay'
center: 'title',
right: 'month,basicWeek,basicDay'
}, },
editable: true, editable: true,
weekMode: 'variable', weekMode: 'variable',
@ -31,8 +29,8 @@
//console.log(this); //console.log(this);
}, },
dayClick: function(dayDate, view) { dayClick: function(dayDate, allDay, ev, view) {
console.log('dayClick - ' + dayDate + ' - ' + view.title); console.log('dayClick - ' + dayDate + ', allDay:' + allDay + ' - ' + view.title);
//console.log(this); //console.log(this);
}, },