Allow a custom invitation text to be sent to attendees (#1788)
- Send the text in iTip COMMENT field only
This commit is contained in:
parent
d3a2c586f0
commit
3ffa80a3a7
6 changed files with 28 additions and 11 deletions
|
@ -930,7 +930,7 @@ class calendar extends rcube_plugin
|
|||
|
||||
// only notify if data really changed (TODO: do diff check on client already)
|
||||
if (!$old || $action == 'remove' || self::event_diff($event, $old)) {
|
||||
$sent = $this->notify_attendees($event, $old, $action);
|
||||
$sent = $this->notify_attendees($event, $old, $action, $event['_comment']);
|
||||
if ($sent > 0)
|
||||
$this->rc->output->show_message('calendar.itipsendsuccess', 'confirmation');
|
||||
else if ($sent < 0)
|
||||
|
@ -1599,7 +1599,7 @@ class calendar extends rcube_plugin
|
|||
/**
|
||||
* Send out an invitation/notification to all event attendees
|
||||
*/
|
||||
private function notify_attendees($event, $old, $action = 'edit')
|
||||
private function notify_attendees($event, $old, $action = 'edit', $comment = null)
|
||||
{
|
||||
if ($action == 'remove' || ($event['status'] == 'CANCELLED' && $old['status'] != $event['status'])) {
|
||||
$event['cancelled'] = true;
|
||||
|
@ -1609,6 +1609,9 @@ class calendar extends rcube_plugin
|
|||
$itip = $this->load_itip();
|
||||
$emails = $this->get_user_emails();
|
||||
|
||||
// add comment to the iTip attachment
|
||||
$event['comment'] = $comment;
|
||||
|
||||
// compose multipart message using PEAR:Mail_Mime
|
||||
$method = $action == 'remove' ? 'CANCEL' : 'REQUEST';
|
||||
$message = $itip->compose_itip_message($event, $method);
|
||||
|
@ -1632,7 +1635,9 @@ class calendar extends rcube_plugin
|
|||
$is_new = !in_array($attendee['email'], $old_attendees);
|
||||
$bodytext = $is_cancelled ? 'eventcancelmailbody' : ($is_new ? 'invitationmailbody' : 'eventupdatemailbody');
|
||||
$subject = $is_cancelled ? 'eventcancelsubject' : ($is_new ? 'invitationsubject' : ($event['title'] ? 'eventupdatesubject':'eventupdatesubjectempty'));
|
||||
|
||||
|
||||
$event['comment'] = $comment;
|
||||
|
||||
// finally send the message
|
||||
if ($itip->send_itip_message($event, $method, $attendee, $subject, $bodytext, $message))
|
||||
$sent++;
|
||||
|
@ -1648,6 +1653,7 @@ class calendar extends rcube_plugin
|
|||
$vevent = $old;
|
||||
$vevent['cancelled'] = $is_cancelled;
|
||||
$vevent['attendees'] = array($attendee);
|
||||
$vevent['comment'] = $comment;
|
||||
if ($itip->send_itip_message($vevent, 'CANCEL', $attendee, 'eventcancelsubject', 'eventcancelmailbody'))
|
||||
$sent++;
|
||||
else
|
||||
|
|
|
@ -615,6 +615,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);
|
||||
var comment = $('#edit-attendees-comment');
|
||||
notify.checked = has_attendees(event), invite.checked = true;
|
||||
|
||||
if (event.allDay) {
|
||||
|
@ -750,6 +751,7 @@ function rcube_calendar_ui(settings)
|
|||
// tell server to send notifications
|
||||
if ((data.attendees.length || (event.id && event.attendees.length)) && allow_invitations && (notify.checked || invite.checked)) {
|
||||
data._notify = 1;
|
||||
data._comment = comment.val();
|
||||
}
|
||||
|
||||
data.calendar = calendars.val();
|
||||
|
|
|
@ -708,15 +708,18 @@ class calendar_ui
|
|||
*/
|
||||
function attendees_form($attrib = array())
|
||||
{
|
||||
$input = new html_inputfield(array('name' => 'participant', 'id' => 'edit-attendee-name', 'size' => 30));
|
||||
$input = new html_inputfield(array('name' => 'participant', 'id' => 'edit-attendee-name', 'size' => 30));
|
||||
$checkbox = new html_checkbox(array('name' => 'invite', 'id' => 'edit-attendees-invite', 'value' => 1));
|
||||
|
||||
$textarea = new html_textarea(array('name' => 'comment', 'id' => 'edit-attendees-comment',
|
||||
'rows' => 4, 'cols' => 55, 'title' => $this->cal->gettext('itipcommenttitle')));
|
||||
|
||||
return html::div($attrib,
|
||||
html::div(null, $input->show() . " " .
|
||||
html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-add', 'value' => $this->cal->gettext('addattendee'))) . " " .
|
||||
html::tag('input', array('type' => 'button', 'class' => 'button', 'id' => 'edit-attendee-schedule', 'value' => $this->cal->gettext('scheduletime').'...'))) .
|
||||
html::p('attendees-invitebox', html::label(null, $checkbox->show(1) . $this->cal->gettext('sendinvitations')))
|
||||
);
|
||||
html::p('attendees-invitebox', html::label(null, $checkbox->show(1) . $this->cal->gettext('sendinvitations'))) .
|
||||
html::p('attendees-commentbox', html::label(null, $this->cal->gettext('comment') . $textarea->show()))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -168,6 +168,7 @@ $labels['itipmailbodycancel'] = "\$sender has rejected your participation in the
|
|||
|
||||
$labels['itipdeclineevent'] = 'Do you want to decline your invitation to this event?';
|
||||
$labels['declinedeleteconfirm'] = 'Do you also want to delete this declined event from your calendar?';
|
||||
$labels['itipcommenttitle'] = 'This comment will be attached to the invitation/notification message send to participants';
|
||||
|
||||
$labels['notanattendee'] = 'You\'re not listed as an attendee of this event';
|
||||
$labels['eventcancelled'] = 'The event has been cancelled';
|
||||
|
|
|
@ -1106,6 +1106,12 @@ td.topalign {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
#eventedit .attendees-commentbox textarea {
|
||||
width: auto;
|
||||
margin-left: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
a.dropdown-link {
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
|
|
|
@ -118,10 +118,9 @@ class libcalendaring_itip
|
|||
)
|
||||
));
|
||||
|
||||
// append sender's comment
|
||||
if (!empty($event['comment'])) {
|
||||
$mailbody .= "\n\n" . $this->gettext('itipsendercomment') . $event['comment'];
|
||||
}
|
||||
// if (!empty($event['comment'])) {
|
||||
// $mailbody .= "\n\n" . $this->gettext('itipsendercomment') . $event['comment'];
|
||||
// }
|
||||
|
||||
// append links for direct invitation replies
|
||||
if ($method == 'REQUEST' && ($token = $this->store_invitation($event, $recipient['email']))) {
|
||||
|
|
Loading…
Add table
Reference in a new issue