first round of commits for 1.4, agenda view

This commit is contained in:
Adam Shaw 2009-10-05 05:47:26 +00:00
parent 1cb53661fd
commit 8e0312a750
7 changed files with 921 additions and 931 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,18 +1,78 @@
.fc-event, /*.fc-event,
.fc-event a, .fc-event a,
.fc-agenda .fc-event-time { .fc-agenda .fc-event-time {
color: #fff; color: #fff;
border-style: solid; border-style: solid;
border-color: blue; border-color: blue;
background-color: blue; background-color: blue;
}*/
.fc .fc-axis {
width: 50px;
height: 1.6em;
padding: 0 4px 0 0;
vertical-align: middle;
white-space: nowrap;
text-align: right;
font-weight: normal;
}
.fc .fc-agenda th,
.fc .fc-agenda td {
border-width: 1px 0 0 1px;
}
.fc-agenda-head tr.fc-all-day th {
height: 2em;
}
.fc-agenda tr.fc-first th,
.fc-agenda tr.fc-first td {
border-top: 0;
}
.fc .fc-agenda .fc-leftmost {
border-left: 0;
}
.fc .fc-agenda-head td,
.fc .fc-agenda-body td {
background: none;
} }
/* header styles */ .fc .fc-agenda-body tr.fc-minor th,
.fc .fc-agenda-body tr.fc-minor td {
border-top-style: dotted;
}
.fc .fc-divider th {
height: 3px;
border-bottom-width: 1px;
}
.fc .fc-divider .fc-state-default {
background: #eee;
}
/* header styles */
/*
.fc .fc-agenda-head th.fc-first { .fc .fc-agenda-head th.fc-first {
border-left: 0; border-left: 0;
} }
@ -31,39 +91,33 @@
border-bottom-width: 2px; border-bottom-width: 2px;
} }
.fc-agenda-head tr.fc-last th { .fc-agenda-head tr.fc-last th {
/*border-width: 1px 0 1px 1px;*/ #border-width: 1px 0 1px 1px;
background-image: none; background-image: none;
} }
.fc-agenda-head tr.fc-last th.fc-first { .fc-agenda-head tr.fc-last th.fc-first {
/*border-width: 0 2px 1px 0;*/ #border-width: 0 2px 1px 0;
} }
.fc-agenda-head tr.fc-last th.fc-last { .fc-agenda-head tr.fc-last th.fc-last {
/*border-width: 0 0 0 3px;*/ #border-width: 0 0 0 3px;
} }
.fc .fc-agenda-head td { .fc .fc-agenda-head td {
/*border-width: 3px 0 3px 1px;*/ #border-width: 3px 0 3px 1px;
background: none; background: none;
} }
.fc-agenda-body { .fc-agenda-body {
/*width: 100%;*/ #width: 100%;
overflow: auto; overflow: auto;
} }
*/
/*
.fc .fc-agenda-body th { .fc .fc-agenda-body th {
border-width: 1px 0 0 0; border-width: 1px 0 0 0;
background-image: none; background-image: none;
@ -106,6 +160,8 @@
.fc-agenda .fc-day-content { .fc-agenda .fc-day-content {
padding: 2px 1px 14px; padding: 2px 1px 14px;
} }
*/

View file

@ -14,6 +14,10 @@
font-size: 1em; font-size: 1em;
} }
.fc {
direction: ltr;
}
.fc table { .fc table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
@ -145,7 +149,7 @@ table.fc-header {
} }
.fc-header .fc-state-default span { .fc-header .fc-state-default span {
border-color: #fff #fff #cecece; /* inner border */ border-color: #fff #fff #d1d1d1; /* inner border */
background: #e8e8e8; background: #e8e8e8;
} }

View file

@ -116,10 +116,6 @@ function Grid(element, options, methods) {
rowCnt = r; rowCnt = r;
colCnt = c; colCnt = c;
var month = view.start.getMonth(),
today = clearTime(new Date()),
s, i, j, d = cloneDate(view.visStart);
// update option-derived variables // update option-derived variables
tm = options.theme ? 'ui' : 'fc'; tm = options.theme ? 'ui' : 'fc';
firstDay = options.firstDay; firstDay = options.firstDay;
@ -131,6 +127,10 @@ function Grid(element, options, methods) {
dit = 0; dit = 0;
} }
var month = view.start.getMonth(),
today = clearTime(new Date()),
s, i, j, d = cloneDate(view.visStart);
if (!tbody) { // first time, build all cells from scratch if (!tbody) { // first time, build all cells from scratch
var table = $("<table/>").appendTo(element); var table = $("<table/>").appendTo(element);
@ -247,12 +247,12 @@ function Grid(element, options, methods) {
}; };
function dayClick() { function dayClick(ev) {
var date = addDays( var date = addDays(
cloneDate(view.visStart), cloneDate(view.visStart),
parseInt(this.className.match(/fc\-day(\d+)/)[1]) parseInt(this.className.match(/fc\-day(\d+)/)[1])
); );
view.trigger('dayClick', this, date); view.trigger('dayClick', this, date, true, ev);
} }

View file

@ -113,7 +113,7 @@ $.fn.fullCalendar = function(options) {
delete options.eventSources; delete options.eventSources;
if (options.events) { if (options.events) {
eventSources.push(options.events); eventSources.push(options.events);
delete options.event; delete options.events;
} }
// first event source reserved for 'sticky' events // first event source reserved for 'sticky' events
@ -137,7 +137,7 @@ $.fn.fullCalendar = function(options) {
// element // element
var _element = this, var _element = this,
element = $(this).addClass('fc'), element = $(this).addClass('fc'),
content = $("<div class='fc-content " + tm + "-widget-content'/>").appendTo(this); content = $("<div class='fc-content " + tm + "-widget-content' style='position:relative'/>").appendTo(this); // relative for ie6
if (options.isRTL) { if (options.isRTL) {
element.addClass('fc-rtl'); element.addClass('fc-rtl');
} }
@ -148,7 +148,6 @@ $.fn.fullCalendar = function(options) {
// view managing // view managing
var date = new Date(), var date = new Date(),
viewName, view, // the current view viewName, view, // the current view
prevView,
viewInstances = {}; viewInstances = {};
if (options.year != undefined) { if (options.year != undefined) {
date.setYear(options.year); date.setYear(options.year);
@ -167,7 +166,14 @@ $.fn.fullCalendar = function(options) {
function changeView(v) { function changeView(v) {
if (v != viewName) { if (v != viewName) {
prevView = view; lockContentSize();
if (view) {
if (view.eventsChanged) {
eventsDirtyExcept(view);
view.eventsChanged = false;
}
view.element.hide();
}
if (viewInstances[v]) { if (viewInstances[v]) {
(view = viewInstances[v]).element.show(); (view = viewInstances[v]).element.show();
}else{ }else{
@ -175,11 +181,6 @@ $.fn.fullCalendar = function(options) {
$("<div class='fc-view fc-view-" + v + "'/>").appendTo(content), $("<div class='fc-view fc-view-" + v + "'/>").appendTo(content),
options); options);
} }
if (prevView && prevView.eventsChanged) {
// if previous view's events have been changed, mark future views' events as dirty
eventsDirtyExcept(prevView);
prevView.eventsChanged = false;
}
if (header) { if (header) {
// update 'active' view button // update 'active' view button
header.find('div.fc-button-' + viewName).removeClass(tm + '-state-active'); header.find('div.fc-button-' + viewName).removeClass(tm + '-state-active');
@ -187,10 +188,7 @@ $.fn.fullCalendar = function(options) {
} }
view.name = viewName = v; view.name = viewName = v;
render(); render();
if (prevView) { unlockContentSize();
// hide the old element AFTER the new has been rendered, preserves scrollbars
prevView.element.hide();
}
} }
} }
@ -622,6 +620,20 @@ $.fn.fullCalendar = function(options) {
/* Resizing /* Resizing
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
function lockContentSize() {
content.css({
overflow: 'hidden',
height: Math.round(content.width() / options.aspectRatio)
});
}
function unlockContentSize() {
content.css({
overflow: '',
height: ($.browser.msie && $.browser.version == '6.0') ? 1 : ''
});
}
var elementWidth, var elementWidth,
ignoreWindowResizes = false, ignoreWindowResizes = false,
resizeCnt = 0; resizeCnt = 0;
@ -630,11 +642,13 @@ $.fn.fullCalendar = function(options) {
if (!ignoreWindowResizes && view.date) { // view.date means the view has been rendered if (!ignoreWindowResizes && view.date) { // view.date means the view has been rendered
var rcnt = ++resizeCnt; // add a delay var rcnt = ++resizeCnt; // add a delay
setTimeout(function() { setTimeout(function() {
if (rcnt == resizeCnt) { if (rcnt == resizeCnt && !ignoreWindowResizes) {
var newWidth = element.width(); var newWidth = element.width();
if (newWidth != elementWidth) { if (newWidth != elementWidth) {
elementWidth = newWidth; elementWidth = newWidth;
lockContentSize();
view.updateSize(); view.updateSize();
unlockContentSize();
view.rerenderEvents(true); view.rerenderEvents(true);
sizesDirtyExcept(view); sizesDirtyExcept(view);
view.trigger('windowResize', _element); view.trigger('windowResize', _element);

View file

@ -1,6 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html> <html>
<head> <head>
<link rel='stylesheet' type='text/css' href='../examples/redmond/theme.css' />
<script type='text/javascript' src='loader.js'></script> <script type='text/javascript' src='loader.js'></script>
<script type='text/javascript'> <script type='text/javascript'>
@ -11,11 +12,15 @@
var m = d.getMonth(); var m = d.getMonth();
$('#calendar').fullCalendar({ $('#calendar').fullCalendar({
//weekMode: 'variable',
theme: true,
//isRTL: true,
editable: true, editable: true,
defaultView: 'agendaWeek',
header: { header: {
left: 'prev,next today', left: 'prev,next today',
center: 'title', center: 'title',
right: 'month,basicWeek,basicDay' right: 'month,agendaWeek,agendaDay'
}, },
events: [ events: [
{ {
@ -51,7 +56,10 @@
url: "http://facebook.com/", url: "http://facebook.com/",
allDay: false allDay: false
} }
] ],
dayClick: function(date, allDay) {
alert(date + ' allDay:' + allDay);
}
}); });
}); });
@ -67,7 +75,7 @@
} }
#calendar { #calendar {
width: 900px; width: 80%;
margin: 0 auto; margin: 0 auto;
} }

View file

@ -47,6 +47,7 @@ if (_build) {
}else{ }else{
includeCSS('../src/css/main.css'); includeCSS('../src/css/main.css');
includeCSS('../src/css/grid.css'); includeCSS('../src/css/grid.css');
includeCSS('../src/css/agenda.css');
} }
if (_legacy) { if (_legacy) {
@ -78,6 +79,7 @@ if (_build) {
}else{ }else{
includeJS('../src/main.js'); includeJS('../src/main.js');
includeJS('../src/grid.js'); includeJS('../src/grid.js');
includeJS('../src/agenda.js');
includeJS('../src/view.js'); includeJS('../src/view.js');
includeJS('../src/util.js'); includeJS('../src/util.js');
includeJS('../src/gcal.js'); includeJS('../src/gcal.js');