From: Jan Schneider Date: Thu, 11 Nov 2010 20:19:45 +0000 (+0100) Subject: Generate a nicer agenda message. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b5da170ee953f8fabd591a11f419bac2a2e3a930;p=horde.git Generate a nicer agenda message. --- diff --git a/kronolith/scripts/agenda.php b/kronolith/scripts/agenda.php index 305807e6f..29fb64d2a 100755 --- a/kronolith/scripts/agenda.php +++ b/kronolith/scripts/agenda.php @@ -32,7 +32,7 @@ function send_agendas() } if (!empty($GLOBALS['conf']['reminder']['server_name'])) { - $GLOBALS['conf']['server']['name'] = $GLOBALS['conf']['reminder']['server_name']; + $_SERVER['SERVER_NAME'] = $GLOBALS['conf']['server']['name'] = $GLOBALS['conf']['reminder']['server_name']; } // Retrieve a list of users associated with each calendar, and @@ -51,11 +51,25 @@ function send_agendas() // Remove duplicates. $users = array_unique($users); + // Generate image mime part first and only once, because we need + // the Content-ID. + $background = new Horde_Themes_Image('big_agenda.png'); + $image = new Horde_Mime_Part(); + $image->setType('image/png'); + $image->setContents(file_get_contents($background->fs)); + $image->setContentId(); + $image->setDisposition('attachment'); + $runtime = new Horde_Date($runtime); $default_timezone = date_default_timezone_get(); $kronolith_driver = Kronolith::getDriver(); $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/agenda', 'encoding' => 'UTF-8')); new Horde_View_Helper_Text($view); + $view->imageId = $image->getContentId(); + $view->date = $runtime; + if (!$GLOBALS['prefs']->isLocked('daily_agenda')) { + $view->prefsUrl = Horde::url(Horde::getServiceLink('prefs', 'kronolith'), true)->remove(session_name()); + } // Loop through the users and generate an agenda for them foreach ($users as $user) { @@ -130,15 +144,14 @@ function send_agendas() ksort($eventlist); $GLOBALS['registry']->setLanguageEnvironment($prefs->getValue('language')); $twentyFour = $prefs->getValue('twentyFour'); - $dateFormat = $prefs->getValue('date_format'); $view->pad = max(Horde_String::length(_("All day")) + 2, $twentyFour ? 6 : 8); - $view->date = $runtime->strftime($dateFormat); + $view->dateFormat = $prefs->getValue('date_format'); $view->timeformat = $twentyFour ? 'H:i' : 'h:ia'; $view->events = $eventlist; $mime_mail = new Horde_Mime_Mail( - array('subject' => sprintf(_("Your daily agenda for %s"), $view->date), + array('subject' => sprintf(_("Your daily agenda for %s"), $runtime->strftime($view->dateFormat)), 'to' => $email, 'from' => $GLOBALS['conf']['reminder']['from_addr'], 'charset' => 'UTF-8')); @@ -153,12 +166,19 @@ function send_agendas() $bodyText->setType('text/plain'); $bodyText->setCharset('UTF-8'); $bodyText->setContents($view->render('notification.plain.php')); + $bodyText->setDisposition('inline'); $multipart->addPart($bodyText); $bodyHtml = new Horde_Mime_Part(); $bodyHtml->setType('text/html'); $bodyHtml->setCharset('UTF-8'); $bodyHtml->setContents($view->render('notification.html.php')); - $multipart->addPart($bodyHtml); + $bodyHtml->setDisposition('inline'); + $related = new Horde_Mime_Part(); + $related->setType('multipart/related'); + $related->setContentTypeParameter('start', $bodyHtml->setContentId()); + $related->addPart($bodyHtml); + $related->addPart($image); + $multipart->addPart($related); $mime_mail->setBasePart($multipart); Horde::logMessage(sprintf('Sending daily agenda to %s', $email), 'DEBUG'); diff --git a/kronolith/templates/agenda/notification.html.php b/kronolith/templates/agenda/notification.html.php index b80afcbce..fbd3ec0c3 100644 --- a/kronolith/templates/agenda/notification.html.php +++ b/kronolith/templates/agenda/notification.html.php @@ -1,19 +1,42 @@ -

h(sprintf(_("Your daily agenda for %s"), $this->date)) ?>

+

h(_("Your daily agenda")) ?>

- - events as $event): ?> +
+ +
+ + + + + + + +
+ date->mday ?> +
date->strftime('%B') ?>
+
+ + events as $event): ?> - - - - - + + + + + + -
- isAllDay()): ?> - h(_("All day")) ?> - - h($event->start->format($this->timeformat)) ?> - + > + + + isAllDay()): ?> + h(_("All day")) ?> + + h($event->start->format($this->timeformat)) ?> + - h($event->title) ?>
 h($event->title) ?>
+
+ + + +prefsUrl): ?> +

prefsUrl . '">', '') ?>

+ diff --git a/kronolith/themes/graphics/big_agenda.png b/kronolith/themes/graphics/big_agenda.png new file mode 100644 index 000000000..88ce7d10f Binary files /dev/null and b/kronolith/themes/graphics/big_agenda.png differ