Calendar display issues

- Fix multiple week with multiple users time divisions were too large
- Clicking in full day space creates full day non-blocking event
- Today & holiday styles only applied to day headings, not full day space
- Fix positioning when multiple events span the same time
This commit is contained in:
Nathan Gray 2015-10-29 21:53:47 +00:00
parent 7d12993e1a
commit 39ab8282f3
3 changed files with 27 additions and 12 deletions

View File

@ -1368,6 +1368,7 @@ class calendar_uiforms extends calendar_ui
// set new start and end if given by $_GET
if(isset($_GET['start'])) { $event['start'] = $_GET['start']; }
if(isset($_GET['end'])) { $event['end'] = $_GET['end']; }
if(isset($_GET['non_blocking'])) { $event['non_blocking'] = (bool)$_GET['non_blocking']; }
// check if the event is the whole day
$start = $this->bo->date2array($event['start']);
$end = $this->bo->date2array($event['end']);

View File

@ -348,12 +348,12 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
this.title.removeClass()
// Except this one...
.addClass("et2_clickable et2_link");
this.header.removeClass('calendar_calBirthday calendar_calHoliday');
this.title.attr('data-holiday','');
// Set today class - note +1 when dealing with today, as months in JS are 0-11
var today = new Date();
this.header.toggleClass("calendar_calToday", this.options.date === ''+today.getUTCFullYear()+
this.title.toggleClass("calendar_calToday", this.options.date === ''+today.getUTCFullYear()+
sprintf("%02d",today.getUTCMonth()+1)+
sprintf("%02d",today.getUTCDate())
);
@ -368,7 +368,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
{
if (typeof holidays[i]['birthyear'] !== 'undefined')
{
this.header.addClass('calendar_calBirthday');
this.title.addClass('calendar_calBirthday');
//If the birthdays are already displayed as event, don't
//show them in the caption
@ -379,8 +379,8 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
}
else
{
this.header.addClass('calendar_calHoliday');
this.header.attr('data-holiday', holidays[i]['name']);
this.title.addClass('calendar_calHoliday');
this.title.attr('data-holiday', holidays[i]['name']);
//If the birthdays are already displayed as event, don't
//show them in the caption
@ -391,7 +391,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
}
}
}
this.header.attr('title', holiday_list.join(','));
this.title.attr('title', holiday_list.join(','));
},
/**
@ -542,7 +542,7 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
for(var c = 0; c < columns.length; c++)
{
// Calculate horizontal positioning
var left = Math.ceil(5 + (1.5 * 100 / (this.options.width || 100)));
var left = Math.ceil(5 + (1.5 * 100 / (parseFloat(this.options.width) || 100)));
var width = 98 - left;
if (columns.length !== 1)
{
@ -658,6 +658,17 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResizea
} , '_blank');
return false;
}
else if ($j(_ev.target).is(this.header))
{
// Click on the header, but not the title. That's an all-day non-blocking
var end = this.date.getFullYear() + '-' + (this.date.getUTCMonth()+1) + '-' + this.date.getUTCDate() + 'T23:59';
this.egw().open(null, 'calendar', 'add', {
start: this.date.toJSON(),
end: end,
non_blocking: true
} , '_blank');
return false;
}
},
// Resizable interface

View File

@ -502,10 +502,6 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
var granularity = this.options.granularity;
var totalDisplayMinutes = wd_end - wd_start;
var rowsToDisplay = (totalDisplayMinutes + 60)/granularity;
// Percent
var rowHeight = (100/rowsToDisplay).toFixed(1);
// Pixels
this.rowHeight = this.div.height() / rowsToDisplay;
this.gridHeader
.empty()
@ -522,6 +518,11 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
.appendTo(this.div)
.empty();
// Percent
var rowHeight = (100/rowsToDisplay).toFixed(1);
// Pixels
this.rowHeight = this.div.height() / rowsToDisplay;
// the hour rows
var show = {
5 : [0,15,30,45],
@ -1286,7 +1287,9 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
// First child is a selectAccount
for(var i = 1; i < this._children.length; i++)
{
if(this._children[i].header && this._children[i].header.has(_ev.target).length)
if(this._children[i].header && (
this._children[i].header.has(_ev.target).length || this._children[i].header.is(_ev.target))
)
{
return this._children[i].click(_ev);
}