Improve layout of daily notifications
authorTim Düsterhus <duesterhus@woltlab.com>
Sun, 19 Jun 2016 15:16:57 +0000 (17:16 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Jul 2016 14:25:53 +0000 (16:25 +0200)
com.woltlab.wcf/templates/email_dailyNotification.tpl
com.woltlab.wcf/templates/email_html.tpl
com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl
com.woltlab.wcf/templates/email_notification_userProfileComment.tpl
com.woltlab.wcf/templates/email_notification_userProfileCommentResponse.tpl
com.woltlab.wcf/templates/email_notification_userProfileCommentResponseOwner.tpl
wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php
wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 5609b932528e073078dc9330d1bfe177ebf9a1a5..a0eb3eceacd34bae82f3f35c615fa0c87e536c10 100644 (file)
@@ -1,27 +1,30 @@
 {if $mimeType === 'text/plain'}
 {capture assign='content'}
-{lang}wcf.user.notification.mail.plaintext.intro{/lang}
+{lang}wcf.user.notification.mail.daily.plaintext.intro{/lang}
 
-{foreach from=$notifications item='notification'}
+---------------
+
+{implode from=$notifications item='notification' glue="\n---------------\n\n"}
 {assign var='event' value=$notification[event]}
 {assign var='notificationContent' value=$notification[notificationContent]}
 {assign var='notificationType' value=$notification[notificationType]}
 {if $notificationContent|is_array}{include file=$notificationContent[template] application=$notificationContent[application] variables=$notificationContent[variables]}{*
-*}{else}{@$notificationContent}{/if}
-{/foreach}
+*}{else}{@$notificationContent|trim}{/if}
+{/implode}
 
-{*lang}TODO: wcf.user.notification.mail.plaintext.outro{/lang*}
+---------------
+{*lang}TODO: wcf.user.notification.mail.daily.plaintext.outro{/lang*}
 {/capture}
 {include file='email_plaintext'}
 {else}
        {capture assign='content'}
-       {lang}wcf.user.notification.mail.html.intro{/lang}
+       {lang}wcf.user.notification.mail.daily.html.intro{/lang}
        
        {foreach from=$notifications item='notification'}
        {assign var='event' value=$notification[event]}
        {assign var='notificationContent' value=$notification[notificationContent]}
        {assign var='notificationType' value=$notification[notificationType]}
-       <div>
+       <div class="largeMarginTop">
                {if $notificationContent|is_array}
                        {include file=$notificationContent[template] application=$notificationContent[application] variables=$notificationContent[variables]}
                {else}
@@ -30,7 +33,7 @@
        </div>
        {/foreach}
 
-       {*lang}TODO: wcf.user.notification.mail.html.outro{/lang*}
+       {*lang}TODO: wcf.user.notification.mail.daily.html.outro{/lang*}
        {/capture}
        {include file='email_html'}
 {/if}
index ffa1a1766ea235c72c7fa3ce11026644291689bd..f87c2837629aa0c9ea48ba07d63cd3ba8db09162 100644 (file)
                        font-weight: 300;
                }
                
+               .largeMarginTop {
+                       margin-top: 40px;
+               }
+               
                {* Buttons *}
                td.button {
                        background-color: {$style->getVariable('wcfButtonPrimaryBackground', true)};
                        padding-left: 20px;
                }
                
+               .box64 {
+                       border-top: 1px solid {$style->getVariable('wcfContentBorder', true)};
+                       border-bottom: 1px solid {$style->getVariable('wcfContentBorder', true)};
+                       padding: 15px;
+               }
+               
+               .box64 td.boxContent {
+                       padding-left: 15px;
+               }
+               
                .containerHeadline h3 {
                        margin: 0;
                        padding: 0;
index 474603f6d4f66e273ad8a2c73f4861849664e718..72070319341ff7d8cf34e340790f96e578b859fc 100644 (file)
@@ -3,15 +3,18 @@
 {else}
        {lang}wcf.user.notification.follow.mail.html{/lang}
        {assign var='user' value=$event->getAuthor()}
+       
+       {if $notificationType == 'instant'}{assign var='avatarSize' value=128}
+       {else}{assign var='avatarSize' value=64}{/if}
        {capture assign='userContent'}
        <table cellpadding="0" cellspacing="0" border="0">
                <tr>
-                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$user->username}">{@$user->getAvatar()->getImageTag(128)}</a></td>
+                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$user->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
                        <td class="boxContent">
                                {include file='email_userInformationHeadline'}
                        </td>
                </tr>
        </table>
        {/capture}
-       {include file='email_paddingHelper' block=true class='box128' content=$userContent sandbox=true}
+       {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$userContent sandbox=true}
 {/if}
index 48aa878d86cfb58d6f447f8ef6de6dcdf6ba6d62..e8ed8e5f14dae916bab5ef7ddcc0a640c8202418 100644 (file)
@@ -1,14 +1,17 @@
 {if $mimeType === 'text/plain'}
 {lang}wcf.user.notification.comment.mail.plaintext{/lang}
-{$event->getUserNotificationObject()->message}
+{$event->getUserNotificationObject()->message} {* this line ends with a space *}
 {else}
        {lang}wcf.user.notification.comment.mail.html{/lang}
        {assign var='user' value=$event->getAuthor()}
        {assign var='comment' value=$event->getUserNotificationObject()}
+       
+       {if $notificationType == 'instant'}{assign var='avatarSize' value=128}
+       {else}{assign var='avatarSize' value=64}{/if}
        {capture assign='commentContent'}
        <table cellpadding="0" cellspacing="0" border="0">
                <tr>
-                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag(128)}</a></td>
+                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
                        <td class="boxContent">
                                <div class="containerHeadline">
                                        <h3>
@@ -28,5 +31,5 @@
                </tr>
        </table>
        {/capture}
-       {include file='email_paddingHelper' block=true class='box128' content=$commentContent sandbox=true}
+       {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
 {/if}
index f1995a58c000ccad64f8255a35200edbe3dc027f..c3570cc9add399fc41f01b61d0ac8eead90903e5 100644 (file)
@@ -1,14 +1,17 @@
 {if $mimeType === 'text/plain'}
 {lang}wcf.user.notification.commentResponse.mail.plaintext{/lang}
-{$event->getUserNotificationObject()->message}
+{$event->getUserNotificationObject()->message} {* this line ends with a space *}
 {else}
        {lang}wcf.user.notification.commentResponse.mail.html{/lang}
        {assign var='user' value=$event->getAuthor()}
        {assign var='comment' value=$event->getUserNotificationObject()}
+       
+       {if $notificationType == 'instant'}{assign var='avatarSize' value=128}
+       {else}{assign var='avatarSize' value=64}{/if}
        {capture assign='commentContent'}
        <table cellpadding="0" cellspacing="0" border="0">
                <tr>
-                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag(128)}</a></td>
+                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
                        <td class="boxContent">
                                <div class="containerHeadline">
                                        <h3>
@@ -28,5 +31,5 @@
                </tr>
        </table>
        {/capture}
-       {include file='email_paddingHelper' block=true class='box128' content=$commentContent sandbox=true}
+       {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
 {/if}
index 85846ac766b351a6bd486819096b6e0450e8a593..c859d043cae953843956f5486b4d9cf04e49afee 100644 (file)
@@ -1,14 +1,17 @@
 {if $mimeType === 'text/plain'}
 {lang}wcf.user.notification.commentResponseOwner.mail.plaintext{/lang}
-{$event->getUserNotificationObject()->message}
+{$event->getUserNotificationObject()->message} {* this line ends with a space *}
 {else}
        {lang}wcf.user.notification.commentResponseOwner.mail.html{/lang}
        {assign var='user' value=$event->getAuthor()}
        {assign var='comment' value=$event->getUserNotificationObject()}
+       
+       {if $notificationType == 'instant'}{assign var='avatarSize' value=128}
+       {else}{assign var='avatarSize' value=64}{/if}
        {capture assign='commentContent'}
        <table cellpadding="0" cellspacing="0" border="0">
                <tr>
-                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag(128)}</a></td>
+                       <td><a href="{link controller='User' object=$user isEmail=true}{/link}" title="{$comment->username}">{@$user->getAvatar()->getImageTag($avatarSize)}</a></td>
                        <td class="boxContent">
                                <div class="containerHeadline">
                                        <h3>
@@ -28,5 +31,5 @@
                </tr>
        </table>
        {/capture}
-       {include file='email_paddingHelper' block=true class='box128' content=$commentContent sandbox=true}
+       {include file='email_paddingHelper' block=true class='box'|concat:$avatarSize content=$commentContent sandbox=true}
 {/if}
index 771d5912c46077c79061b1c7340d31895bac6486..01832135c3acb3da6ae467b21afef29cd8e055da 100644 (file)
@@ -182,14 +182,13 @@ class DailyMailNotificationCronjob extends AbstractCronjob {
                                
                                $message = $class->getEmailMessage('daily');
                                if (is_array($message)) {
+                                       if (!isset($message['variables'])) $message['variables'] = [];
                                        $variables = [
                                                'notificationContent' => $message,
                                                'event' => $class,
-                                               'notificationType' => 'daily'
+                                               'notificationType' => 'daily',
+                                               'variables' => $message['variables']
                                        ];
-                                       if (isset($message['variables'])) {
-                                               $variables['variables'] = $message['variables'];
-                                       }
                                        
                                        return $variables;
                                }
index 28be7619b0e451d4421625f74b8e15ab780e7f89..94328d740ce30bde4cb03ff68a387bfbc3d1b33d 100644 (file)
@@ -667,14 +667,14 @@ class UserNotificationHandler extends SingletonFactory {
                
                $message = $event->getEmailMessage('instant');
                if (is_array($message)) {
+                       if (!isset($message['variables'])) $message['variables'] = [];
                        $variables = [
                                'notificationContent' => $message,
                                'event' => $event,
-                               'notificationType' => 'instant'
+                               'notificationType' => 'instant',
+                               'variables' => $message['variables']
                        ];
-                       if (isset($message['variables'])) {
-                               $variables['variables'] = $message['variables'];
-                       }
+                       
                        if (isset($message['message-id'])) {
                                $email->setMessageID($message['message-id']);
                        }
index 4099c8a7f2e178eba3acc1fbaf2ef5f8ccb2cdb3..97d5dccd48c14d2a0298c260a6388d888bcd2334 100644 (file)
@@ -3267,6 +3267,12 @@ Benachrichtigungen auf <a href="{link isEmail=true}{/link}">{PAGE_TITLE|language
 
 <p>Wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} nur diese E-Mail-Benachrichtigung nicht mehr erhalten {if LANGUAGE_USE_INFORMAL_VARIANT}möchtest{else}möchten{/if}, dann {if LANGUAGE_USE_INFORMAL_VARIANT}kannst du{else}können Sie{/if} diese direkt <a href="{link controller='NotificationDisable' isEmail=true}eventID={@$event->eventID}&userID={@$mailbox->getUser()->userID}&token={@$mailbox->getUser()->notificationMailToken}{/link}">abbestellen</a>.</p>]]></item>
                <item name="wcf.user.notification.mail.daily.subject"><![CDATA[{if $count == 1}Neue Benachrichtigung{else}{#$count} neue Benachrichtigungen{/if}]]></item>
+               <item name="wcf.user.notification.mail.daily.plaintext.intro"><![CDATA[Hallo {@$mailbox->getUser()->username},
+
+{if LANGUAGE_USE_INFORMAL_VARIANT}du hast{else}Sie haben{/if} derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigungen, die älter als 24 Stunden sind:]]></item>
+               <item name="wcf.user.notification.mail.daily.html.intro"><![CDATA[<h1>Hallo {@$mailbox->getUser()->username},</h1>
+
+<p>{if LANGUAGE_USE_INFORMAL_VARIANT}du hast{else}Sie haben{/if} haben derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigungen, die älter als 24 Stunden sind:</p>]]></item>
                <item name="wcf.user.notification.mail.daily.footer"><![CDATA[Diese E-Mail ist eine automatische Benachrichtigung. BITTE {if LANGUAGE_USE_INFORMAL_VARIANT}ANTWORTE{else}ANTWORTEN SIE{/if} NICHT AUF DIESE E-MAIL.
                
 {if LANGUAGE_USE_INFORMAL_VARIANT}Du kannst{else}Sie können{/if} die Einstellungen für {if LANGUAGE_USE_INFORMAL_VARIANT}deine{else}Ihre{/if} Benachrichtigungen auf {@PAGE_TITLE|language} unter folgender URL detailliert konfigurieren:
index 40898149a84d4a7bdf8f7d57ce61d24cbb2a7d56..b68b6cd0a67583f9d7bb9e011f9553563324e049 100644 (file)
@@ -3304,6 +3304,12 @@ your notifications on <a href="{link isEmail=true}{/link}">{PAGE_TITLE|language}
 
 <p>You can <a href="{link controller='NotificationDisable' isEmail=true}eventID={@$event->eventID}&userID={@$mailbox->getUser()->userID}&token={@$mailbox->getUser()->notificationMailToken}{/link}">disable only this type of notification</a> as well.</p>]]></item>
                <item name="wcf.user.notification.mail.daily.subject"><![CDATA[{if $count == 1}New Notification{else}{#$count} New Notifications{/if}]]></item>
+               <item name="wcf.user.notification.mail.daily.plaintext.intro"><![CDATA[Dear {@$mailbox->getUser()->username},
+
+you currently have got {#$notifications|count} unread notifications that are older than 24 hours:]]></item>
+               <item name="wcf.user.notification.mail.daily.html.intro"><![CDATA[<h1>Hallo {@$mailbox->getUser()->username},</h1>
+
+<p>you currently have got {#$notifications|count} unread notifications that are older than 24 hours:</p>]]></item>
                <item name="wcf.user.notification.mail.daily.footer"><![CDATA[This is an automatic notification, PLEASE DO NOT REPLY TO THIS EMAIL!
                
 You can manage your notification settings for {@PAGE_TITLE|language} on the page below: