From 9ef2cbd98a6d40acedf5f5f2231a247508b752ec Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 16 Jul 2015 09:34:55 +0000 Subject: [PATCH] * Mail/Kalendar: remove iCal from alarms and correctly display canceled events in mail --- calendar/inc/class.calendar_boupdate.inc.php | 6 +- calendar/inc/class.calendar_uiforms.inc.php | 73 +++++++++++++------- calendar/lang/egw_de.lang | 3 + calendar/lang/egw_en.lang | 3 + calendar/templates/default/meeting.xet | 7 ++ mail/inc/class.mail_ui.inc.php | 7 +- 6 files changed, 67 insertions(+), 32 deletions(-) diff --git a/calendar/inc/class.calendar_boupdate.inc.php b/calendar/inc/class.calendar_boupdate.inc.php index f333de2e1c..a0868d77c3 100644 --- a/calendar/inc/class.calendar_boupdate.inc.php +++ b/calendar/inc/class.calendar_boupdate.inc.php @@ -691,7 +691,6 @@ class calendar_boupdate extends calendar_bo case MSG_ALARM: $action = 'Alarm'; $pref = 'Alarm'; - $method = 'PUBLISH'; // duno if thats right break; default: $method = 'PUBLISH'; @@ -902,7 +901,8 @@ class calendar_boupdate extends calendar_bo //error_log(__METHOD__."() userid=$userid, timezone=".$timezone->getName().", startdate=$details[startdate], enddate=$details[enddate], updated=$details[updated], olddate=$details[olddate]"); list($subject,$notify_body) = explode("\n",$GLOBALS['egw']->preferences->parse_notify($notify_msg,$details),2); - switch($part_prefs['calendar']['update_format']) + // alarm is NOT an iCal method, therefore we have to use extened (no iCal) + switch($msg_type == MSG_ALARM ? 'extended' : $part_prefs['calendar']['update_format']) { case 'ical': if (is_null($ics) || $m_type != $msg_type) // need different ical for organizer notification @@ -955,7 +955,7 @@ class calendar_boupdate extends calendar_bo $notification->set_receivers(array($userid)); $notification->set_sender($senderid); $notification->set_subject($subject); - // as we want ical body to be just describtion, we can NOT set links, as they get appended to body + // as we want ical body to be just description, we can NOT set links, as they get appended to body if ($part_prefs['calendar']['update_format'] != 'ical') { $notification->set_message($notify_body."\n\n".$details['description']."\n\n".$details_body); diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 1e186399e6..7c85d70337 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -1789,6 +1789,10 @@ class calendar_uiforms extends calendar_ui } $event['id'] = $existing_event['id']; } + else // event not in calendar + { + $readonlys['button[cancel]'] = true; // no way to remove a canceled event not in calendar + } $event['participant_types'] = array(); foreach($event['participants'] as $uid => $status) { @@ -1808,7 +1812,8 @@ class calendar_uiforms extends calendar_ui $msg .= ($msg ? "\n" : '').lang('You are not invited to that event!'); if ($event['id']) { - $readonlys['button[accept]'] = $readonlys['button[tentativ]'] = $readonlys['button[reject]'] = true; + $readonlys['button[accept]'] = $readonlys['button[tentativ]'] = + $readonlys['button[reject]'] = $readonlys['button[cancel]'] = true; } } // ignore events in the past (for recurring events check enddate!) @@ -1816,7 +1821,8 @@ class calendar_uiforms extends calendar_ui (!$event['recur_type'] || $event['recur_enddate'] && $event['recur_enddate'] < $this->bo->now_su)) { $msg = lang('Requested meeting is in the past!'); - $readonlys['button[accept]'] = $readonlys['button[tentativ]'] = $readonlys['button[reject]'] = true; + $readonlys['button[accept]'] = $readonlys['button[tentativ]'] = + $readonlys['button[reject]'] = $readonlys['button[cancel]'] = true; } } else @@ -1877,6 +1883,12 @@ class calendar_uiforms extends calendar_ui } break; + case 'cancel': + if ($event['id'] && $this->bo->set_status($event['id'], $user, 'R')) + { + $msg = lang('Status changed'); + } + break; } // add notification-errors, if we have some $msg = array_merge((array)$msg, notifications::errors(true)); @@ -1884,8 +1896,19 @@ class calendar_uiforms extends calendar_ui $event['msg'] = implode("\n",(array)$msg); $readonlys['button[edit]'] = !$event['id']; $event['ics_method'] = $readonlys['ics_method'] = strtolower($ical_method); - $event['ics_method_label'] = strtolower($ical_method) == 'request' ? - lang('Meeting request') : lang('Reply to meeting request'); + switch(strtolower($ical_method)) + { + case 'reply': + $event['ics_method_label'] = lang('Reply to meeting request'); + break; + case 'cancel': + $event['ics_method_label'] = lang('Meeting canceled'); + break; + case 'request': + default: + $event['ics_method_label'] = lang('Meeting request'); + break; + } $tpl = new etemplate_new('calendar.meeting'); $tpl->exec('calendar.calendar_uiforms.meeting', $event, array(), $readonlys, $event, 2); } @@ -2498,21 +2521,21 @@ class calendar_uiforms extends calendar_ui /** * moves an event to another date/time * - * @param string $eventId id of the event which has to be moved + * @param string $_eventId id of the event which has to be moved * @param string $calendarOwner the owner of the calendar the event is in * @param string $targetDateTime the datetime where the event should be moved to, format: YYYYMMDD * @param string $targetOwner the owner of the target calendar * @param string $durationT the duration to support resizable calendar event * @return string XML response if no error occurs */ - function ajax_moveEvent($eventId,$calendarOwner,$targetDateTime,$targetOwner,$durationT=null) + function ajax_moveEvent($_eventId,$calendarOwner,$targetDateTime,$targetOwner,$durationT=null) { // we do not allow dragging into another users calendar ATM if(!$calendarOwner == $targetOwner) { return false; } - list($eventId, $date) = explode(':',$eventId); + list($eventId, $date) = explode(':', $_eventId); $old_event=$event=$this->bo->read($eventId); if (!$durationT) { @@ -2526,19 +2549,19 @@ class calendar_uiforms extends calendar_ui // If we have a recuring event for a particular day, make an exception if ($event['recur_type'] != MCAL_RECUR_NONE && $date) { - $date = new egw_time($date, egw_time::$user_timezone); + $d = new egw_time($date, egw_time::$user_timezone); if (!empty($event['whole_day'])) { - $date =& $this->bo->so->startOfDay($date); - $date->setUser(); + $d =& $this->bo->so->startOfDay($d); + $d->setUser(); } - $event = $this->bo->read($eventId, $date, true); - $preserv['actual_date'] = $date; // remember the date clicked + $event = $this->bo->read($eventId, $d, true); + $preserv['actual_date'] = $d; // remember the date clicked // For DnD, always create an exception $this->_create_exception($event,$preserv); unset($event['id']); - $date = $date->format('ts'); + $date = $d->format('ts'); } $event['start'] = $this->bo->date2ts($targetDateTime); @@ -2605,31 +2628,31 @@ class calendar_uiforms extends calendar_ui /** * Change the status via ajax - * @param string $eventId - * @param integer $user + * @param string $_eventId + * @param integer $uid * @param string $status */ - function ajax_status($eventId, $uid, $status) + function ajax_status($_eventId, $uid, $status) { - list($eventId, $date) = explode(':',$eventId); - $old_event=$event=$this->bo->read($eventId); + list($eventId, $date) = explode(':', $_eventId); + $event = $this->bo->read($eventId); // If we have a recuring event for a particular day, make an exception if ($event['recur_type'] != MCAL_RECUR_NONE && $date) { - $date = new egw_time($date, egw_time::$user_timezone); + $d = new egw_time($date, egw_time::$user_timezone); if (!empty($event['whole_day'])) { - $date =& $this->bo->so->startOfDay($date); - $date->setUser(); + $d =& $this->bo->so->startOfDay($date); + $d->setUser(); } - $event = $this->bo->read($eventId, $date, true); - $preserv['actual_date'] = $date; // remember the date clicked + $event = $this->bo->read($eventId, $d, true); + $preserv['actual_date'] = $d; // remember the date clicked // For DnD, always create an exception $this->_create_exception($event,$preserv); unset($event['id']); - $date = $date->format('ts'); + $date = $d->format('ts'); } if($event['participants'][$uid]) { @@ -2661,7 +2684,7 @@ class calendar_uiforms extends calendar_ui '',750,410); } } - + /** * Deletes an event */ diff --git a/calendar/lang/egw_de.lang b/calendar/lang/egw_de.lang index d27d3a6049..84b65569c5 100644 --- a/calendar/lang/egw_de.lang +++ b/calendar/lang/egw_de.lang @@ -173,6 +173,7 @@ download calendar de Herunterladen download this event as ical calendar de Termin als iCal herunterladen duration calendar de Dauer duration of the meeting calendar de Dauer des Termins +edit event in calendar calendar de Termin im Kalender bearbeiten edit exception calendar de Ausnahme bearbeiten edit series calendar de Serie bearbeiten edit status or alarms for this particular day calendar de Bearbeite Status oder Alarme für diesen speziellen Tag @@ -323,6 +324,7 @@ make freebusy information available to not loged in persons? calendar de Die fre manage mapping calendar de Feldzuordnungen verwalten max. number of entries to show (leave empty for no restriction) calendar de Max. Anzahl von Einträgen die angezeigt werden sollen (Kein Eintrag = Keine Beschränkung) maximum available quantity of %1 exceeded! calendar de Maximale Anzahl von %1 erreicht! +meeting canceled calendar de Termin abgesagt meeting request calendar de Terminanfrage meetingrequest to all participants calendar de Terminanforderung an alle Teilnehmer merge document... calendar de Dokument einfügen... @@ -521,6 +523,7 @@ this entry is opened by user: calendar de Dieser Eintrag ist von einem anderen B this event is part of a series calendar de Dieser Termin ist Teil einer Serie this group that is preselected when you enter the planner. you can change it in the planner anytime you want. calendar de Diese Gruppe wird als Vorauswahl ausgewählt wenn Sie den Planer öffnen. Sie können die Gruppe jederzeit wechseln wenn Sie möchten. this is a recurring event. do you want to delete just this recurrence or the whole series? calendar de Das ist ein wiederholender Termin. Wollen Sie nur diese Wiederholung oder die ganze Serie löschen? +this mail cancels a meeting calendar de Diese Nachricht sagt einen Termin ab this mail contains a meeting request calendar de Diese Nachricht enthält eine Terminanfrage this mail contains a reply to a meeting request calendar de Diese Nachricht enthält eine Antwort auf eine Terminanfrage this message is sent for canceled or deleted events. calendar de Diese Benachrichtigung wird für stornierte oder gelöschte Termine versendet. diff --git a/calendar/lang/egw_en.lang b/calendar/lang/egw_en.lang index e221c4eb67..edc76a71b0 100644 --- a/calendar/lang/egw_en.lang +++ b/calendar/lang/egw_en.lang @@ -173,6 +173,7 @@ download calendar en Download download this event as ical calendar en Download this event as iCal duration calendar en Duration duration of the meeting calendar en Duration of the meeting +edit event in calendar calendar en Edit event in calendar edit exception calendar en Edit exception edit series calendar en Edit series edit status or alarms for this particular day calendar en Edit status or alarms for this particular day @@ -323,6 +324,7 @@ make freebusy information available to not loged in persons? calendar en Make Fr manage mapping calendar en Manage mapping max. number of entries to show (leave empty for no restriction) calendar en Max. number of entries to show. Leave empty for no restriction. maximum available quantity of %1 exceeded! calendar en Maximum available quantity of %1 exceeded! +meeting canceled calendar en Meeting canceled meeting request calendar en Meeting request meetingrequest to all participants calendar en Meetingrequest to all participants merge document... calendar en Merge document... @@ -521,6 +523,7 @@ this entry is opened by user: calendar en This entry was opened within the confi this event is part of a series calendar en This event is part of a series this group that is preselected when you enter the planner. you can change it in the planner anytime you want. calendar en This group that is preselected when you enter the planner. You can change it in the planner at any time. this is a recurring event. do you want to delete just this recurrence or the whole series? calendar en This is a recurring event. Do you want to delete just this recurrence or the whole series? +this mail cancels a meeting calendar en This mail cancels a meeting this mail contains a meeting request calendar en This mail contains a meeting request this mail contains a reply to a meeting request calendar en This mail contains a reply to a meeting request this message is sent for canceled or deleted events. calendar en This message is sent for canceled or deleted events. diff --git a/calendar/templates/default/meeting.xet b/calendar/templates/default/meeting.xet index 3c57e91371..7e8696906a 100644 --- a/calendar/templates/default/meeting.xet +++ b/calendar/templates/default/meeting.xet @@ -27,6 +27,13 @@ + + +