* Calendar/FMail: allow to apply replys to meeting requests

This commit is contained in:
Ralf Becker 2013-02-01 12:22:56 +00:00
parent 38a3d0eb3f
commit ceb66bf332
3 changed files with 67 additions and 28 deletions

View File

@ -1671,7 +1671,7 @@ function replace_eTemplate_onsubmit()
} }
/** /**
* Display a meeting request (iCal) for FMail and allow to accept, tentative or reject it * Display for FMail an iCal meeting request and allow to accept, tentative or reject it or a reply and allow to apply it
* *
* @todo Handle situation when user is NOT invited, but eg. can view that mail ... * @todo Handle situation when user is NOT invited, but eg. can view that mail ...
* @param array $event=null * @param array $event=null
@ -1681,6 +1681,7 @@ function replace_eTemplate_onsubmit()
{ {
$user = $GLOBALS['egw_info']['user']['account_id']; $user = $GLOBALS['egw_info']['user']['account_id'];
$readonlys['button[apply]'] = true;
if (!is_array($event)) if (!is_array($event))
{ {
$ical_charset = 'utf-8'; $ical_charset = 'utf-8';
@ -1691,6 +1692,7 @@ function replace_eTemplate_onsubmit()
$ical_string = $session_data['attachment']; $ical_string = $session_data['attachment'];
$ical_charset = $session_data['charset']; $ical_charset = $session_data['charset'];
$ical_method = $session_data['method']; $ical_method = $session_data['method'];
$ical_sender = $session_data['sender'];
unset($session_data); unset($session_data);
} }
$ical = new calendar_ical(); $ical = new calendar_ical();
@ -1704,31 +1706,50 @@ function replace_eTemplate_onsubmit()
$event = array_shift($events); $event = array_shift($events);
if (($existing_event = $this->bo->read($event['uid'])) && !$existing_event['deleted']) if (($existing_event = $this->bo->read($event['uid'])) && !$existing_event['deleted'])
{ {
$event = $existing_event; switch(strtolower($ical_method))
foreach((array)$event['participants'] as $uid => $status)
{ {
calendar_so::split_status($status, $quantity, $role); case 'reply':
if ($role == 'CHAIR') if ($ical_sender && ($event['ical_sender_uid'] = groupdav_principals::url2uid('mailto:'.$ical_sender)) &&
{ isset($existing_event['participants'][$event['ical_sender_uid']]) &&
$event['organizer'] = $this->bo->participant_name($uid,false,true); $this->bo->check_status_perms($event['ical_sender_uid'], $existing_event))
{
$status = $event['participants'][$event['ical_sender_uid']];
calendar_so::split_status($status, $quantity, $role);
$existing_status = $existing_event['participants'][$event['ical_sender_uid']];
calendar_so::split_status($existing_status, $quantity, $role);
if ($existing_status != $status)
{
$readonlys['button[apply]'] = false;
}
else
{
$msg = lang('Status already applied');
}
}
break;
case 'request':
$status = $existing_event['participants'][$user];
calendar_so::split_status($status, $quantity, $role);
if (strtolower($ical_method) == 'response' && isset($existing_event['participants'][$user]) &&
$status != 'U' && isset($this->bo->verbose_status[$status]))
{
$msg = lang('You already replied to this invitation with').': '.lang($this->bo->verbose_status[$status]);
}
else
{
$msg = lang('Using already existing event on server.');
}
break; break;
}
} }
if (empty($event['organizer'])) $event['id'] = $existing_event['id'];
{
$event['organizer'] = $this->bo->participant_name($event['owner'],false,true);
}
$msg = lang('Using already existing event on server.');
} }
else $event['participant_types'] = array();
foreach($event['participants'] as $uid => $status)
{ {
$event['participant_types'] = array(); calendar_so::split_user($uid, $user_type, $user_id);
foreach($event['participants'] as $uid => $status) $event['participants'][$uid] = $event['participant_types'][$user_type][$user_id] =
{ $status && $status !== 'X' ? $status : 'U'; // X --> no status given --> U = unknown
calendar_so::split_user($uid, $user_type, $user_id);
$event['participants'][$uid] = $event['participant_types'][$user_type][$user_id] =
$status && $status !== 'X' ? $status : 'U'; // X --> no status given --> U = unknown
}
} }
//error_log(__METHOD__."(...) parsed as ".array2string($event)); //error_log(__METHOD__."(...) parsed as ".array2string($event));
$event['recure'] = $this->bo->recure2string($event); $event['recure'] = $this->bo->recure2string($event);
@ -1793,17 +1814,29 @@ function replace_eTemplate_onsubmit()
} }
} }
// set status and send notification / meeting response // set status and send notification / meeting response
if ($this->bo->set_status($event, $user, $status)) if ($this->bo->set_status($event['id'], $user, $status))
{ {
if (!$msg) $msg = lang('Status changed'); if (!$msg) $msg = lang('Status changed');
} }
break; break;
case 'apply':
// set status and send notification / meeting response
$status = $event['participants'][$event['ical_sender_status']];
calendar_so::split_status($status, $quantity, $role);
if ($this->bo->set_status($event['id'], $event['ical_sender_uid'], $status))
{
$msg = lang('Status changed');
}
break;
} }
} }
$event['msg'] = implode("\n",(array)$msg); $event['msg'] = implode("\n",(array)$msg);
$readonlys['button[edit]'] = !$event['id']; $readonlys['button[edit]'] = !$event['id'];
$event['ics_method'] = $readonlys['ics_method'] = strtolower($ical_method); $event['ics_method'] = $readonlys['ics_method'] = strtolower($ical_method);
$event['ics_method_label'] = (strtolower($ical_method)=='request'?lang('Meeting request'):lang('Meeting status information')); $event['ics_method_label'] = strtolower($ical_method) == 'request' ?
lang('Meeting request') : lang('Reply to meeting request');
$tpl = new etemplate('calendar.meeting'); $tpl = new etemplate('calendar.meeting');
$tpl->exec('calendar.calendar_uiforms.meeting', $event, $sel_options, $readonlys, $event, 2); $tpl->exec('calendar.calendar_uiforms.meeting', $event, $sel_options, $readonlys, $event, 2);
} }

View File

@ -281,8 +281,7 @@ mail all participants calendar de Mail an alle Teilnehmer
make freebusy information available to not loged in persons? calendar de Die Belegtzeiten für nicht angemeldete Personen verfügbar machen? make freebusy information available to not loged in persons? calendar de Die Belegtzeiten für nicht angemeldete Personen verfügbar machen?
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) 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! maximum available quantity of %1 exceeded! calendar de Maximale Anzahl von %1 erreicht!
meeting request calendar de Termineinladung meeting request calendar de Terminanfrage
meeting status information calendar de Terminstatus
merge document... calendar de Dokument einfügen... merge document... calendar de Dokument einfügen...
minutes calendar de Minuten minutes calendar de Minuten
modified calendar de Geändert modified calendar de Geändert
@ -374,6 +373,7 @@ repeating interval, eg. 2 to repeat every second week calendar de Wiederholungsi
repetition calendar de Wiederholung repetition calendar de Wiederholung
repetitiondetails (or empty) calendar de Details der Wiederholung (oder leer) repetitiondetails (or empty) calendar de Details der Wiederholung (oder leer)
replacements for inserting events into documents calendar de Platzhalter für das Einfügen von Terminen in Dokumente replacements for inserting events into documents calendar de Platzhalter für das Einfügen von Terminen in Dokumente
reply to meeting request calendar de Antwort auf Terminanfrage
requested calendar de Erforderlich requested calendar de Erforderlich
requested date %1 outside allowed range of %2 days: recurring events obmitted! calendar de Gewünschtes Datum %1 außerhalb des erlauben Bereiches von %2 Tagen: wiederholdende Termine ausgelassen! requested date %1 outside allowed range of %2 days: recurring events obmitted! calendar de Gewünschtes Datum %1 außerhalb des erlauben Bereiches von %2 Tagen: wiederholdende Termine ausgelassen!
requested meeting is in the past! calendar de Termin, zu dem eingeladen wird, ist in der Vergangenheit! requested meeting is in the past! calendar de Termin, zu dem eingeladen wird, ist in der Vergangenheit!
@ -448,6 +448,7 @@ startdate / -time calendar de Startdatum / -zeit
startdate and -time of the search calendar de Startdatum und -zeit der Suche startdate and -time of the search calendar de Startdatum und -zeit der Suche
startdate of the export calendar de Startdatum des Exports startdate of the export calendar de Startdatum des Exports
startrecord calendar de Startdatensatz startrecord calendar de Startdatensatz
status already applied calendar de Der Status wurde bereits übernommen
status changed calendar de Status geändert status changed calendar de Status geändert
status for all future scheduled days changed calendar de Status alle zukünftig geplanten Termine geändert status for all future scheduled days changed calendar de Status alle zukünftig geplanten Termine geändert
status for this particular day changed calendar de Status für diesen Tag geändert status for this particular day changed calendar de Status für diesen Tag geändert
@ -468,7 +469,8 @@ this entry is currently opened by %1! calendar de Dieser Termin ist im Moment vo
this entry is opened by user: calendar de Dieser Eintrag ist von einem anderen Benutzer innerhalb des konfigurierten Zeitintervalls geöffnet worden: this entry is opened by user: calendar de Dieser Eintrag ist von einem anderen Benutzer innerhalb des konfigurierten Zeitintervalls geöffnet worden:
this event is part of a series calendar de Dieser Termin ist Teil einer Serie 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 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 mail contains a meeting request calendar de Diese Nachricht enthält eine Termineinladung 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. this message is sent for canceled or deleted events. calendar de Diese Benachrichtigung wird für stornierte oder gelöschte Termine versendet.
this message is sent for modified or moved events. calendar de Diese Benachrichtigung wird für geänderte Termine versendet. this message is sent for modified or moved events. calendar de Diese Benachrichtigung wird für geänderte Termine versendet.
this message is sent to disinvited participants. calendar de Diese Nachricht wird ausgeladenen Teilnehmern gesendet. this message is sent to disinvited participants. calendar de Diese Nachricht wird ausgeladenen Teilnehmern gesendet.
@ -544,9 +546,10 @@ years admin de Jahre
yearview calendar de Jahresansicht yearview calendar de Jahresansicht
yes, only admins can purge deleted items admin de Ja, nur Administratoren können gelöschte Einträge bereinigen yes, only admins can purge deleted items admin de Ja, nur Administratoren können gelöschte Einträge bereinigen
yes, users can purge their deleted items admin de Ja, Benutzer können gelöschte Einträge selbst bereinigen yes, users can purge their deleted items admin de Ja, Benutzer können gelöschte Einträge selbst bereinigen
you already replied to this invitation with calendar de Sie haben bereits auf diese Einladung geantwortet mit
you are not allowed to book the resource selected: calendar de Sie sind nicht berechtigt die ausgewählte Ressource zu buchen. you are not allowed to book the resource selected: calendar de Sie sind nicht berechtigt die ausgewählte Ressource zu buchen.
you are not invited to that event! calendar de Sie sind zu diesem Termin nicht eingeladen! you are not invited to that event! calendar de Sie sind zu diesem Termin nicht eingeladen!
you attempt to mail a meetingrequest to the recipients above. depending on the client this mail is opened with, the recipient may or may not see the mailbody below, but only see the meeting request attached. calendar de Sie sind im Begriff eine Terminanforderung an die oben eingetragenen Empfänger zu versenden. Abhängig vom MailClient wird der jeweilige Empfänger die unten stehende Nachricht nie zu Gesicht bekommen, sondern nur die vom MailClient aufbereitete Terminanforderung. you attempt to mail a meetingrequest to the recipients above. depending on the client this mail is opened with, the recipient may or may not see the mailbody below, but only see the meeting request attached. calendar de Sie sind im Begriff eine Terminanfrage an die oben eingetragenen Empfänger zu versenden. Abhängig vom MailClient wird der jeweilige Empfänger die unten stehende Nachricht nie zu Gesicht bekommen, sondern nur die vom MailClient aufbereitete Terminanforderung.
you can either set a year or a occurence, not both !!! calendar de Sie können nur entweder das Jahr oder die Wiederholung angeben, nicht beides! you can either set a year or a occurence, not both !!! calendar de Sie können nur entweder das Jahr oder die Wiederholung angeben, nicht beides!
you can only set a year or a occurence !!! calendar de Sie können nur ein Jahr oder eine Wiederholung angeben ! you can only set a year or a occurence !!! calendar de Sie können nur ein Jahr oder eine Wiederholung angeben !
you do not have permission to read this record! calendar de Sie haben keine Berechtigung diesen Eintrag zu lesen! you do not have permission to read this record! calendar de Sie haben keine Berechtigung diesen Eintrag zu lesen!

View File

@ -286,7 +286,6 @@ make freebusy information available to not loged in persons? calendar en Make Fr
max. number of entries to show (leave empty for no restriction) calendar en Max. number of entries to show. Leave empty for no restriction. 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! maximum available quantity of %1 exceeded! calendar en Maximum available quantity of %1 exceeded!
meeting request calendar en Meeting request meeting request calendar en Meeting request
meeting status information calendar en Meeting status information
merge document... calendar en Merge document... merge document... calendar en Merge document...
minutes calendar en Minutes minutes calendar en Minutes
modified calendar en Modified modified calendar en Modified
@ -380,6 +379,7 @@ repeating interval, eg. 2 to repeat every second week calendar en Repeating inte
repetition calendar en Repetition repetition calendar en Repetition
repetitiondetails (or empty) calendar en Repetition details (or empty) repetitiondetails (or empty) calendar en Repetition details (or empty)
replacements for inserting events into documents calendar en Replacements for inserting events into documents replacements for inserting events into documents calendar en Replacements for inserting events into documents
reply to meeting request calendar en Reply to meeting request
requested calendar en Requested requested calendar en Requested
requested date %1 outside allowed range of %2 days: recurring events obmitted! calendar en Requested date %1 outside allowed range of %2 days: recurring events obmitted! requested date %1 outside allowed range of %2 days: recurring events obmitted! calendar en Requested date %1 outside allowed range of %2 days: recurring events obmitted!
requested meeting is in the past! calendar en Requested meeting is in the past! requested meeting is in the past! calendar en Requested meeting is in the past!
@ -454,6 +454,7 @@ startdate / -time calendar en Start date / time
startdate and -time of the search calendar en Start date and time of the search startdate and -time of the search calendar en Start date and time of the search
startdate of the export calendar en Start date of the export startdate of the export calendar en Start date of the export
startrecord calendar en Start record startrecord calendar en Start record
status already applied calendar en Status already applied
status changed calendar en Status changed. status changed calendar en Status changed.
status for all future scheduled days changed calendar en Status for all future scheduled days changed. status for all future scheduled days changed calendar en Status for all future scheduled days changed.
status for this particular day changed calendar en Status for this particular day changed. status for this particular day changed calendar en Status for this particular day changed.
@ -475,6 +476,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 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 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 mail contains a meeting request calendar en This mail contains a meeting request 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. this message is sent for canceled or deleted events. calendar en This message is sent for canceled or deleted events.
this message is sent for modified or moved events. calendar en This message is sent for modified or moved events. this message is sent for modified or moved events. calendar en This message is sent for modified or moved events.
this message is sent to disinvited participants. calendar en This message is sent to disinvited participants. this message is sent to disinvited participants. calendar en This message is sent to disinvited participants.
@ -551,6 +553,7 @@ years admin en years
yearview calendar en Year view yearview calendar en Year view
yes, only admins can purge deleted items admin en Yes, only admins can purge deleted items yes, only admins can purge deleted items admin en Yes, only admins can purge deleted items
yes, users can purge their deleted items admin en Yes, users can purge their deleted items yes, users can purge their deleted items admin en Yes, users can purge their deleted items
you already replied to this invitation with calendar en You already replied to this invitation with
you are not allowed to book the resource selected: calendar en You are not allowed to book the resource selected: you are not allowed to book the resource selected: calendar en You are not allowed to book the resource selected:
you are not invited to that event! calendar en You are not invited to that event! you are not invited to that event! calendar en You are not invited to that event!
you attempt to mail a meetingrequest to the recipients above. depending on the client this mail is opened with, the recipient may or may not see the mailbody below, but only see the meeting request attached. calendar en You attempt to mail a meetingrequest to the recipients above. Depending on the client this mail is opened with, the recipient may or may not see the message below, but only see the meeting request attached. you attempt to mail a meetingrequest to the recipients above. depending on the client this mail is opened with, the recipient may or may not see the mailbody below, but only see the meeting request attached. calendar en You attempt to mail a meetingrequest to the recipients above. Depending on the client this mail is opened with, the recipient may or may not see the message below, but only see the meeting request attached.