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-agenda .fc-event-time {
color: #fff;
border-style: solid;
border-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 {
border-left: 0;
}
@ -31,39 +91,33 @@
border-bottom-width: 2px;
}
.fc-agenda-head tr.fc-last th {
/*border-width: 1px 0 1px 1px;*/
#border-width: 1px 0 1px 1px;
background-image: none;
}
.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 {
/*border-width: 0 0 0 3px;*/
#border-width: 0 0 0 3px;
}
.fc .fc-agenda-head td {
/*border-width: 3px 0 3px 1px;*/
#border-width: 3px 0 3px 1px;
background: none;
}
.fc-agenda-body {
/*width: 100%;*/
#width: 100%;
overflow: auto;
}
*/
/*
.fc .fc-agenda-body th {
border-width: 1px 0 0 0;
background-image: none;
@ -106,6 +160,8 @@
.fc-agenda .fc-day-content {
padding: 2px 1px 14px;
}
*/

View file

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

View file

@ -116,10 +116,6 @@ function Grid(element, options, methods) {
rowCnt = r;
colCnt = c;
var month = view.start.getMonth(),
today = clearTime(new Date()),
s, i, j, d = cloneDate(view.visStart);
// update option-derived variables
tm = options.theme ? 'ui' : 'fc';
firstDay = options.firstDay;
@ -131,6 +127,10 @@ function Grid(element, options, methods) {
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
var table = $("<table/>").appendTo(element);
@ -247,12 +247,12 @@ function Grid(element, options, methods) {
};
function dayClick() {
function dayClick(ev) {
var date = addDays(
cloneDate(view.visStart),
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;
if (options.events) {
eventSources.push(options.events);
delete options.event;
delete options.events;
}
// first event source reserved for 'sticky' events
@ -137,7 +137,7 @@ $.fn.fullCalendar = function(options) {
// element
var _element = this,
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) {
element.addClass('fc-rtl');
}
@ -148,7 +148,6 @@ $.fn.fullCalendar = function(options) {
// view managing
var date = new Date(),
viewName, view, // the current view
prevView,
viewInstances = {};
if (options.year != undefined) {
date.setYear(options.year);
@ -167,7 +166,14 @@ $.fn.fullCalendar = function(options) {
function changeView(v) {
if (v != viewName) {
prevView = view;
lockContentSize();
if (view) {
if (view.eventsChanged) {
eventsDirtyExcept(view);
view.eventsChanged = false;
}
view.element.hide();
}
if (viewInstances[v]) {
(view = viewInstances[v]).element.show();
}else{
@ -175,11 +181,6 @@ $.fn.fullCalendar = function(options) {
$("<div class='fc-view fc-view-" + v + "'/>").appendTo(content),
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) {
// update 'active' view button
header.find('div.fc-button-' + viewName).removeClass(tm + '-state-active');
@ -187,10 +188,7 @@ $.fn.fullCalendar = function(options) {
}
view.name = viewName = v;
render();
if (prevView) {
// hide the old element AFTER the new has been rendered, preserves scrollbars
prevView.element.hide();
}
unlockContentSize();
}
}
@ -622,6 +620,20 @@ $.fn.fullCalendar = function(options) {
/* 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,
ignoreWindowResizes = false,
resizeCnt = 0;
@ -630,11 +642,13 @@ $.fn.fullCalendar = function(options) {
if (!ignoreWindowResizes && view.date) { // view.date means the view has been rendered
var rcnt = ++resizeCnt; // add a delay
setTimeout(function() {
if (rcnt == resizeCnt) {
if (rcnt == resizeCnt && !ignoreWindowResizes) {
var newWidth = element.width();
if (newWidth != elementWidth) {
elementWidth = newWidth;
lockContentSize();
view.updateSize();
unlockContentSize();
view.rerenderEvents(true);
sizesDirtyExcept(view);
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">
<html>
<head>
<link rel='stylesheet' type='text/css' href='../examples/redmond/theme.css' />
<script type='text/javascript' src='loader.js'></script>
<script type='text/javascript'>
@ -11,11 +12,15 @@
var m = d.getMonth();
$('#calendar').fullCalendar({
//weekMode: 'variable',
theme: true,
//isRTL: true,
editable: true,
defaultView: 'agendaWeek',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
right: 'month,agendaWeek,agendaDay'
},
events: [
{
@ -51,7 +56,10 @@
url: "http://facebook.com/",
allDay: false
}
]
],
dayClick: function(date, allDay) {
alert(date + ' allDay:' + allDay);
}
});
});
@ -67,7 +75,7 @@
}
#calendar {
width: 900px;
width: 80%;
margin: 0 auto;
}

View file

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