diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index d0dc34c2..4d506ffc 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -506,7 +506,7 @@ class calendar extends rcube_plugin $success = $reload = $got_msg = false; // read old event data in order to find changes - if ($event['_notify']) + if ($event['_notify'] && $action != 'new') $old = $this->driver->get_event($event); switch ($action) { @@ -588,7 +588,7 @@ class calendar extends rcube_plugin $event = $this->driver->get_event($event); // only notify if data really changed (TODO: do diff check on client already) - if (self::event_diff($event, $old)) { + if (!$old || self::event_diff($event, $old)) { if ($this->notify_attendees($event, $old) < 0) $this->rc->output->show_message('calendar.errornotifying', 'error'); } @@ -1388,7 +1388,7 @@ class calendar extends rcube_plugin foreach ($fblist as $slot) { list($from, $to, $type) = $slot; - if ($from <= $end && $to > $start) { + if ($from < $end && $to > $start) { $status = isset($type) && $fbtypemap[$type] ? $fbtypemap[$type] : 'BUSY'; break; } @@ -1441,7 +1441,7 @@ class calendar extends rcube_plugin $t = $t_end; } - echo json_encode(array('email' => $email, 'start' => intval($start), 'interval' => $interval, 'slots' => $slots)); + echo json_encode(array('email' => $email, 'start' => intval($start), 'end' => intval($t_end), 'interval' => $interval, 'slots' => $slots)); exit; } diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js index f29ea27d..0b2b7049 100644 --- a/plugins/calendar/calendar_ui.js +++ b/plugins/calendar/calendar_ui.js @@ -371,7 +371,7 @@ function rcube_calendar_ui(settings) var allday = $('#edit-allday').get(0); var notify = $('#edit-attendees-donotify').get(0); var invite = $('#edit-attendees-invite').get(0); - notify.checked = invite.checked = true; // enable notification by default + notify.checked = false, invite.checked = true; if (event.allDay) { starttime.val("00:00").hide(); @@ -464,11 +464,13 @@ function rcube_calendar_ui(settings) if (calendar.attendees && event.attendees) { for (var j=0; j < event.attendees.length; j++) add_attendee(event.attendees[j], true); - $('#edit-attendees-notify').show(); + + if (event.attendees.length > 1 || event.attendees[0].email != settings.event_owner.email) { + notify.checked = invite.checked = true; // enable notification by default + } } - else - $('#edit-attendees-notify').hide(); - + + $('#edit-attendees-notify')[(notify.checked?'show':'hide')](); $('#edit-attendee-schedule')[(calendar.freebusy?'show':'hide')](); // attachments @@ -763,7 +765,7 @@ function rcube_calendar_ui(settings) // set css class according to working hours css = is_weekend(curdate) || (freebusy_ui.interval <= 60 && !is_workinghour(curdate)) ? 'offhours' : 'workinghours'; - times_row += '