Snap allday events to day start when dragging; disable freebusy features if backend doesn't support it
This commit is contained in:
parent
54367e737c
commit
3fabdefc77
2 changed files with 24 additions and 8 deletions
|
@ -1182,7 +1182,7 @@ class calendar extends rcube_plugin
|
||||||
$event['attendees'][$i]['role'] = 'ORGANIZER';
|
$event['attendees'][$i]['role'] = 'ORGANIZER';
|
||||||
}
|
}
|
||||||
else if (!$organizer && $identity['email']) {
|
else if (!$organizer && $identity['email']) {
|
||||||
$event['attendees'][] = array('role' => 'ORGANIZER', 'name' => $identity['name'], 'email' => $identity['email'], 'status' => 'ACCEPTED');
|
array_unshift($event['attendees'], array('role' => 'ORGANIZER', 'name' => $identity['name'], 'email' => $identity['email'], 'status' => 'ACCEPTED'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -448,6 +448,7 @@ function rcube_calendar_ui(settings)
|
||||||
for (var j=0; j < event.attendees.length; j++)
|
for (var j=0; j < event.attendees.length; j++)
|
||||||
add_attendee(event.attendees[j], true);
|
add_attendee(event.attendees[j], true);
|
||||||
}
|
}
|
||||||
|
$('#edit-attendee-schedule')[(calendar.freebusy?'show':'hide')]();
|
||||||
|
|
||||||
// attachments
|
// attachments
|
||||||
if (calendar.attachments) {
|
if (calendar.attachments) {
|
||||||
|
@ -626,8 +627,8 @@ function rcube_calendar_ui(settings)
|
||||||
freebusy_ui.endtime = $('#schedule-endtime').val($.fullCalendar.formatDate(event.end, settings['time_format'])).show();
|
freebusy_ui.endtime = $('#schedule-endtime').val($.fullCalendar.formatDate(event.end, settings['time_format'])).show();
|
||||||
|
|
||||||
if (allday.checked) {
|
if (allday.checked) {
|
||||||
starttime.val("00:00").hide();
|
freebusy_ui.starttime.val("00:00").hide();
|
||||||
endtime.val("23:59").hide();
|
freebusy_ui.endtime.val("23:59").hide();
|
||||||
event.allDay = true;
|
event.allDay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -826,12 +827,21 @@ function rcube_calendar_ui(settings)
|
||||||
var range_t = freebusy_ui.end.getTime() - freebusy_ui.start.getTime();
|
var range_t = freebusy_ui.end.getTime() - freebusy_ui.start.getTime();
|
||||||
var newstart = new Date(freebusy_ui.start.getTime() + px * (range_t / range_p));
|
var newstart = new Date(freebusy_ui.start.getTime() + px * (range_t / range_p));
|
||||||
newstart.setSeconds(0); newstart.setMilliseconds(0);
|
newstart.setSeconds(0); newstart.setMilliseconds(0);
|
||||||
// round to 5 minutes
|
// set time to 00:00
|
||||||
var round = newstart.getMinutes() % 5;
|
if (me.selected_event.allDay) {
|
||||||
if (round > 2.5) newstart.setTime(newstart.getTime() + (5 - round) * 60000);
|
newstart.setMinutes(0);
|
||||||
else if (round > 0) newstart.setTime(newstart.getTime() - round * 60000);
|
newstart.setHours(0);
|
||||||
// update event times
|
}
|
||||||
|
else {
|
||||||
|
// round to 5 minutes
|
||||||
|
var round = newstart.getMinutes() % 5;
|
||||||
|
if (round > 2.5) newstart.setTime(newstart.getTime() + (5 - round) * 60000);
|
||||||
|
else if (round > 0) newstart.setTime(newstart.getTime() - round * 60000);
|
||||||
|
}
|
||||||
|
// update event times and display
|
||||||
update_freebusy_dates(newstart, new Date(newstart.getTime() + freebusy_ui.startdate.data('duration') * 1000));
|
update_freebusy_dates(newstart, new Date(newstart.getTime() + freebusy_ui.startdate.data('duration') * 1000));
|
||||||
|
if (me.selected_event.allDay)
|
||||||
|
render_freebusy_overlay();
|
||||||
}
|
}
|
||||||
}).data('isdraggable', true);
|
}).data('isdraggable', true);
|
||||||
}
|
}
|
||||||
|
@ -1131,6 +1141,12 @@ function rcube_calendar_ui(settings)
|
||||||
// load free-busy status from server and update icon accordingly
|
// load free-busy status from server and update icon accordingly
|
||||||
var check_freebusy_status = function(icon, email, event)
|
var check_freebusy_status = function(icon, email, event)
|
||||||
{
|
{
|
||||||
|
var calendar = event.calendar && me.calendars[event.calendar] ? me.calendars[event.calendar] : { freebusy:false };
|
||||||
|
if (!calendar) {
|
||||||
|
$(icon).removeClass().addClass('availabilityicon unknown');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
icon = $(icon).removeClass().addClass('availabilityicon loading');
|
icon = $(icon).removeClass().addClass('availabilityicon loading');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
Loading…
Add table
Reference in a new issue