* Mail/Kalendar: remove iCal from alarms and correctly display canceled events in mail

This commit is contained in:
Ralf Becker 2015-07-16 09:34:55 +00:00
parent 6cf9385c48
commit 9ef2cbd98a
6 changed files with 67 additions and 32 deletions

View File

@ -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);

View File

@ -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
*/

View File

@ -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.

View File

@ -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.

View File

@ -27,6 +27,13 @@
<description/>
<description/>
</row>
<row disabled="!@ics_method=cancel">
<description value="This mail cancels a meeting" class="meetingRequestMessage"/>
<button label="Apply" id="button[cancel]" class="leftPad5"/>
<description/>
<description/>
<description/>
</row>
</rows>
</grid>
<description/>

View File

@ -2855,7 +2855,6 @@ class mail_ui
foreach ($attachments as &$attach)
{
if (strtolower($attach['mimeType']) == 'text/calendar' &&
(strtolower($attach['method']) == 'request' || strtolower($attach['method']) == 'reply') &&
isset($GLOBALS['egw_info']['user']['apps']['calendar']) &&
($attachment = $this->mail_bo->getAttachment($uid, $attach['partID'],0,(strtolower($attach['mimeType']) == 'text/calendar'?false:true))))
{
@ -3087,7 +3086,7 @@ class mail_ui
return $body;
}
/**
* Resolve inline images from CID to proper url
*
@ -3113,7 +3112,7 @@ class mail_ui
return $_body;
}
}
/**
* Replace CID with proper type of content understandable by browser
*
@ -3215,7 +3214,7 @@ class mail_ui
}
return false;
};
// return new body content base on chosen type
switch($_type)
{