forked from extern/egroupware
* Mail/Kalendar: remove iCal from alarms and correctly display canceled events in mail
This commit is contained in:
parent
adf2a7140f
commit
d3e241988b
@ -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);
|
||||
|
@ -1780,6 +1780,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)
|
||||
{
|
||||
@ -1799,7 +1803,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!)
|
||||
@ -1807,7 +1812,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
|
||||
@ -1868,6 +1874,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));
|
||||
@ -1875,8 +1887,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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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/>
|
||||
|
@ -4148,89 +4148,10 @@ class emailadmin_imapbase
|
||||
'mimeType' => $_structure->getType() == 'text/html' ? 'text/html' : 'text/plain',
|
||||
'charSet' => $_structure->getCharset(),
|
||||
);
|
||||
/* RB: not sure this is still necessary
|
||||
if ($_structure->type == 'TEXT' && $_structure->subType == 'PLAIN' &&
|
||||
is_array($_structure->parameters) && isset($_structure->parameters['FORMAT']) &&
|
||||
trim(strtolower($_structure->parameters['FORMAT']))=='flowed'
|
||||
)
|
||||
{
|
||||
if (self::$debug) error_log(__METHOD__.' ('.__LINE__.') '." detected TEXT/PLAIN Format:flowed -> removing leading blank ('\r\n ') per line");
|
||||
$bodyPart['body'] = str_replace("\r\n ","\r\n", $bodyPart['body']);
|
||||
}
|
||||
*/
|
||||
if ($_structure->getSubType() == 'calendar')
|
||||
{
|
||||
$bodyPart['body'] = $this->getEvent($_structure->getContents(), $_structure->getContentTypeParameter('METHOD'));
|
||||
}
|
||||
}
|
||||
return $bodyPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return inline ical as html
|
||||
*
|
||||
* @param string $ical iCal data
|
||||
* @param string $method iTip method eg. 'REPLY'
|
||||
* @return string text to display instead
|
||||
*/
|
||||
function getEvent($ical, $method=null)
|
||||
{
|
||||
// we get an inline CALENDAR ical/ics, we display it using the calendar notification style
|
||||
$calobj = new calendar_ical;
|
||||
$calboupdate = new calendar_boupdate;
|
||||
// timezone stuff
|
||||
$tz_diff = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'] - $this->common_prefs['tz_offset'];
|
||||
// form an event out of ical
|
||||
$events = $calobj->icaltoegw($ical);
|
||||
$event =& $events[0];
|
||||
// preset the olddate
|
||||
$olddate = $calboupdate->format_date($event['start']+$tz_diff);
|
||||
// search egw, if we can find it
|
||||
$eventid = $calobj->find_event(array('uid'=>$event['uid']));
|
||||
if ((int)$eventid[0]>0)
|
||||
{
|
||||
// we found an event, we use the first one
|
||||
$oldevent = $calobj->read($eventid);
|
||||
// we set the olddate, to comply with the possible merge params for the notification message
|
||||
if($oldevent != False && $oldevent[$eventid[0]]['start']!=$event[$eventid[0]]['start']) {
|
||||
$olddate = $calboupdate->format_date($oldevent[$eventid[0]]['start']+$tz_diff);
|
||||
}
|
||||
// we merge the changes and the original event
|
||||
$event = array_merge($oldevent[$eventid[0]],$event);
|
||||
// for some strange reason, the title of the old event is not replaced with the new title
|
||||
// if you klick on the ics and import it into egw, so we dont show the title here.
|
||||
// so if it is a mere reply, we dont use the new title (more detailed info/work needed here)
|
||||
if ($method == 'REPLY') $event['title'] = $oldevent[$eventid[0]]['title'];
|
||||
}
|
||||
// we prepare the message
|
||||
$details = $calboupdate->_get_event_details($event,'',$event_arr=array());
|
||||
$details['olddate']=$olddate;
|
||||
//_debug_array($_structure);
|
||||
list($subject,$info) = $calboupdate->get_update_message($event, $method !='REPLY');
|
||||
$info = $GLOBALS['egw']->preferences->parse_notify($info,$details);
|
||||
|
||||
// we set the bodyPart, we only show the event, we dont actually do anything, as we expect the user to
|
||||
// click on the attached ics to update his own eventstore
|
||||
$text = $subject;
|
||||
$text .= "\n".$info;
|
||||
$text .= "\n\n".lang('Event Details follow').":\n";
|
||||
foreach($event_arr as $key => $val)
|
||||
{
|
||||
if(strlen($details[$key])) {
|
||||
switch($key){
|
||||
case 'access':
|
||||
case 'priority':
|
||||
case 'link':
|
||||
break;
|
||||
default:
|
||||
$text .= sprintf("%-20s %s\n",$val['field'].':',$details[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Body of message
|
||||
*
|
||||
|
@ -2839,7 +2839,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))))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user