Better handling for drag & drop of multi-day events between blocking & non-blocking areas

This commit is contained in:
nathangray 2016-06-08 10:16:17 -06:00
parent fa7cbf6fcd
commit 0d77d8e62a
2 changed files with 13 additions and 8 deletions

View File

@ -2663,6 +2663,14 @@ class calendar_uiforms extends calendar_ui
{ {
$duration=$event['end']-$event['start']; $duration=$event['end']-$event['start'];
} }
// Drag a normal event to whole day non-blocking
else if ($durationT == 'whole_day')
{
$event['whole_day'] = true;
$event['non_blocking'] = true;
// Make duration whole days, less 1 second
$duration = round(($event['end']-$event['start'])/DAY_s) * DAY_s - 1;
}
else else
{ {
$duration = (int)$durationT; $duration = (int)$durationT;
@ -2743,12 +2751,6 @@ class calendar_uiforms extends calendar_ui
// Whole day non blocking with DAY_s would add a day // Whole day non blocking with DAY_s would add a day
if($duration==DAY_s) $duration=0; if($duration==DAY_s) $duration=0;
} }
// Drag a normal event to whole day non-blocking
else if ($durationT == 'whole_day')
{
$event['whole_day'] = true;
$event['non_blocking'] = true;
}
$status_reset_to_unknown = false; $status_reset_to_unknown = false;
$sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start'])); $sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start']));

View File

@ -476,8 +476,11 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
{ {
//Edit calendar event //Edit calendar event
// Duration - check for whole day dropped on a time, change it to full day // Duration - check for whole day dropped on a time, change it to full days
var duration = event_widget.options.value.whole_day && dropEnd.hour ? 86400-1 : false; var duration = event_widget.options.value.whole_day && dropEnd.hour ?
// Make duration whole days, less 1 second
(Math.round((event_widget.options.value.end - event_widget.options.value.start) / (1000 * 86400)) * 86400) -1 :
false;
// Event (whole day or not) dropped on whole day section, change to whole day non blocking // Event (whole day or not) dropped on whole day section, change to whole day non blocking
if(dropEnd.whole_day) duration = 'whole_day'; if(dropEnd.whole_day) duration = 'whole_day';