From 90562273f201c1a541e79a0e20892eaddc1c91dd Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 7 Dec 2010 15:47:22 +0100 Subject: [PATCH] Use templates when notifying about owner changes. --- kronolith/lib/Kronolith.php | 27 ++++++++++++------------ kronolith/templates/share/notification.html.php | 4 ++++ kronolith/templates/share/notification.plain.php | 4 ++++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 84383c35a..832da7267 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -1707,10 +1707,6 @@ class Kronolith $view->user = $identity->getName(); $view->calendar = $share->get('name'); $view->imageId = $image->getContentId(); - if ($GLOBALS['conf']['share']['hidden']) { - $view->subscribe = Horde::url('calendars/subscribe.php', true)->add('calendar', $share->getName()); - } - $multipart = Kronolith::buildMimeMessage($view, 'notification', $image); } // Process owner and owner permissions. @@ -1726,25 +1722,28 @@ class Kronolith $share->set('owner', $new_owner); $share->save(); if ($GLOBALS['conf']['share']['notify']) { + $view->ownerChange = true; + $multipart = Kronolith::buildMimeMessage($view, 'notification', $image); $to = $GLOBALS['injector'] ->getInstance('Horde_Core_Factory_Identity') ->create($new_owner) ->getDefaultFromAddress(true); - try { - $message = Horde::callHook('shareOwnerNotification', array($new_owner, $share)); - } catch (Horde_Exception_HookNotSet $e) { - $message = sprintf(_("%s has assigned the ownership of \"%s\" to you"), - $view->user, - $share->get('name')); - } - $mail->addHeader('Subject', _("Ownership assignment")); - $mail->addHeader('To', $to, 'UTF-8', false); - $mail->setBody($message, 'UTF-8'); + $mail->addHeader('Subject', _("Ownership assignment"), 'UTF-8'); + $mail->addHeader('To', $to, 'UTF-8'); + $mail->setBasePart($multipart); $mail->send($GLOBALS['injector']->getInstance('Horde_Mail')); + $view->ownerChange = false; } } } + if ($GLOBALS['conf']['share']['notify']) { + if ($GLOBALS['conf']['share']['hidden']) { + $view->subscribe = Horde::url('calendars/subscribe.php', true)->add('calendar', $share->getName()); + } + $multipart = Kronolith::buildMimeMessage($view, 'notification', $image); + } + if ($GLOBALS['registry']->isAdmin() || !empty($GLOBALS['conf']['share']['world'])) { // Process default permissions. diff --git a/kronolith/templates/share/notification.html.php b/kronolith/templates/share/notification.html.php index 951331030..19b53cf0f 100644 --- a/kronolith/templates/share/notification.html.php +++ b/kronolith/templates/share/notification.html.php @@ -9,12 +9,16 @@ + ownerChange): ?> + ' . $this->h($this->user) . '', '' . $this->h($this->calendar) . '') ?> + ' . $this->h($this->user) . '', '' . $this->h($this->calendar) . '') ?> subscribe): ?>

h($this->subscribe) ?> +
diff --git a/kronolith/templates/share/notification.plain.php b/kronolith/templates/share/notification.plain.php index dbd942462..6aaf4350f 100644 --- a/kronolith/templates/share/notification.plain.php +++ b/kronolith/templates/share/notification.plain.php @@ -1,6 +1,9 @@ user, $this->calendar) ?> +ownerChange): ?> +user, $this->calendar) ?> + user, $this->calendar) ?> subscribe): ?> @@ -8,3 +11,4 @@ subscribe ?> + -- 2.11.0