//
// throw new Horde_Exception('Unknown action');
// }
-
- /**
- * Generates the e-mail notification message when the share owner changes.
- *
- * @param string $user The new owner.
- * @param Horde_Share $share A calendar or tasklist.
- */
-// public function shareOwnerNotification($user, Horde_Share $share)
-// {
-// return 'Some fancy text including the ' . $user . ' and the ' . $share->get('name');
-// }
-
- /**
- * Generates the e-mail notification message when the share permissions
- * change.
- *
- * @param string $user A user who has been added to the permissions.
- * @param Horde_Share $share A calendar or tasklist.
- */
-// public function shareUserNotification($user, Horde_Share $share)
-// {
-// return 'Some fancy text including the ' . $user . ' and the ' . $share->get('name');
-// }
-
- /**
- * Generates the e-mail notification message when the share permissions
- * change.
- *
- * @param mixed $group The id of a group that has been added to the
- * permissions.
- * @param Horde_Share $share A calendar or tasklist.
- */
-// public function shareGroupNotification($group, Horde_Share $share)
-// {
-// return 'Some fancy text including the ' . $group . ' and the ' . $share->get('name');
-// }
}
$identity = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_Identity')
->create();
- $userName = $identity->getName();
$mail = new Horde_Mime_Mail(
array('from' => $identity->getDefaultFromAddress(true),
'charset' => 'UTF-8')
);
$mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
+ $image = self::getImagePart('big_share.png');
+ $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/share'));
+ new Horde_View_Helper_Text($view);
+ $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.
$message = Horde::callHook('shareOwnerNotification', array($new_owner, $share));
} catch (Horde_Exception_HookNotSet $e) {
$message = sprintf(_("%s has assigned the ownership of \"%s\" to you"),
- $userName,
+ $view->user,
$share->get('name'));
}
$mail->addHeader('Subject', _("Ownership assignment"));
$perm->removeCreatorPermission(Kronolith::PERMS_DELEGATE, false);
}
- // Build subscription link if necessary.
- $subscription = $sublink = '';
- if ($GLOBALS['conf']['share']['hidden']) {
- $sublink = Horde::url('calendars/subscribe.php', true)->add('calendar', $share->getName());
- $subscription = "\n"
- . _("To subscribe to this calendar, you need to click the following link:")
- . ' ' . $sublink;
- }
-
// Process user permissions.
$u_names = Horde_Util::getFormData('u_names');
$u_show = Horde_Util::getFormData('u_show');
->getInstance('Horde_Core_Factory_Identity')
->create($user)
->getDefaultFromAddress(true);
- try {
- $message = Horde::callHook('shareUserNotification', array($user, $share, $sublink));
- } catch (Horde_Exception_HookNotSet $e) {
- $message = sprintf(_("%s has given you access to \"%s\"."),
- $userName,
- $share->get('name'))
- . $subscription;
- }
$mail->addHeader('To', $to, 'UTF-8', false);
- $mail->setBody($message, 'UTF-8');
+ $mail->setBasePart($multipart);
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
!isset($current[$group]) && $has_perms) {
$groupOb = $GLOBALS['injector']->getInstance('Horde_Group')->getGroupById($group);
if (!empty($groupOb->data['email'])) {
- try {
- $message = Horde::callHook('shareGroupNotification', array($group, $share, $sublink));
- } catch (Horde_Exception_HookNotSet $e) {
- $message = sprintf(_("%s has given your group \"%s\" access to \"%s\"."),
- $userName,
- $groupOb->getName(),
- $share->get('name'))
- . $subscription;
- }
$mail->addHeader('To', $groupOb->getName() . ' <' . $groupOb->data['email'] . '>', 'UTF-8', false);
- $mail->setBody($message, 'UTF-8');
+ $mail->setBasePart($multipart);
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
}
}
--- /dev/null
+<p><font size="4"><strong><?php printf(_("Invitation from %s to the calendar %s"), $this->h($this->user), $this->h($this->calendar)) ?></strong></font></p>
+
+<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
+ <td width="140" valign="top">
+ <img src="cid:<?php echo $this->imageId ?>" />
+ </td>
+ <td valign="top">
+ <table width="100%" border="0" cellpadding="5" cellspacing="0">
+ <tr>
+ <td>
+ <font size="2">
+ <?php printf(_("%s wants to share the calendar %s with you to grant you access to all events in this calendar."), '<strong>' . $this->h($this->user) . '</strong>', '<strong>' . $this->h($this->calendar) . '</strong>') ?>
+ <?php if ($this->subscribe): ?>
+ <?php echo _("To subscribe to this calendar, you need to click the following link:") ?>
+ <br><br>
+ <strong><a href="<?php echo $this->h($this->subscribe) ?>"><?php echo $this->h($this->subscribe) ?></a></strong>
+ <?php endif ?>
+ </font>
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr></table>