From: Tim Düsterhus Date: Sun, 19 Jun 2016 15:16:57 +0000 (+0200) Subject: Improve layout of daily notifications X-Git-Tag: 3.0.0_Beta_1~916^2~1^2~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b16a5be66916681df8ae8160db0d22257b7ddf65;p=GitHub%2FWoltLab%2FWCF.git Improve layout of daily notifications --- diff --git a/com.woltlab.wcf/templates/email_dailyNotification.tpl b/com.woltlab.wcf/templates/email_dailyNotification.tpl index 5609b93252..a0eb3eceac 100644 --- a/com.woltlab.wcf/templates/email_dailyNotification.tpl +++ b/com.woltlab.wcf/templates/email_dailyNotification.tpl @@ -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]} -
+
{if $notificationContent|is_array} {include file=$notificationContent[template] application=$notificationContent[application] variables=$notificationContent[variables]} {else} @@ -30,7 +33,7 @@
{/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} diff --git a/com.woltlab.wcf/templates/email_html.tpl b/com.woltlab.wcf/templates/email_html.tpl index ffa1a1766e..f87c283762 100644 --- a/com.woltlab.wcf/templates/email_html.tpl +++ b/com.woltlab.wcf/templates/email_html.tpl @@ -52,6 +52,10 @@ font-weight: 300; } + .largeMarginTop { + margin-top: 40px; + } + {* Buttons *} td.button { background-color: {$style->getVariable('wcfButtonPrimaryBackground', true)}; @@ -72,6 +76,16 @@ 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; diff --git a/com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl b/com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl index 474603f6d4..7207031934 100644 --- a/com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl +++ b/com.woltlab.wcf/templates/email_notification_userFollowFollowing.tpl @@ -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'} - +
{@$user->getAvatar()->getImageTag(128)}{@$user->getAvatar()->getImageTag($avatarSize)} {include file='email_userInformationHeadline'}
{/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} diff --git a/com.woltlab.wcf/templates/email_notification_userProfileComment.tpl b/com.woltlab.wcf/templates/email_notification_userProfileComment.tpl index 48aa878d86..e8ed8e5f14 100644 --- a/com.woltlab.wcf/templates/email_notification_userProfileComment.tpl +++ b/com.woltlab.wcf/templates/email_notification_userProfileComment.tpl @@ -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'} - +
{@$user->getAvatar()->getImageTag(128)}{@$user->getAvatar()->getImageTag($avatarSize)}

@@ -28,5 +31,5 @@

{/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} diff --git a/com.woltlab.wcf/templates/email_notification_userProfileCommentResponse.tpl b/com.woltlab.wcf/templates/email_notification_userProfileCommentResponse.tpl index f1995a58c0..c3570cc9ad 100644 --- a/com.woltlab.wcf/templates/email_notification_userProfileCommentResponse.tpl +++ b/com.woltlab.wcf/templates/email_notification_userProfileCommentResponse.tpl @@ -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'} - +
{@$user->getAvatar()->getImageTag(128)}{@$user->getAvatar()->getImageTag($avatarSize)}

@@ -28,5 +31,5 @@

{/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} diff --git a/com.woltlab.wcf/templates/email_notification_userProfileCommentResponseOwner.tpl b/com.woltlab.wcf/templates/email_notification_userProfileCommentResponseOwner.tpl index 85846ac766..c859d043ca 100644 --- a/com.woltlab.wcf/templates/email_notification_userProfileCommentResponseOwner.tpl +++ b/com.woltlab.wcf/templates/email_notification_userProfileCommentResponseOwner.tpl @@ -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'} - +
{@$user->getAvatar()->getImageTag(128)}{@$user->getAvatar()->getImageTag($avatarSize)}

@@ -28,5 +31,5 @@

{/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} diff --git a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php index 771d5912c4..01832135c3 100644 --- a/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php +++ b/wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php @@ -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; } diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 28be7619b0..94328d740c 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -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']); } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 4099c8a7f2..97d5dccd48 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -3267,6 +3267,12 @@ Benachrichtigungen auf {PAGE_TITLE|language

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 abbestellen.

]]> + 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:]]> + Hallo {@$mailbox->getUser()->username}, + +

{if LANGUAGE_USE_INFORMAL_VARIANT}du hast{else}Sie haben{/if} haben derzeit insgesamt {#$notifications|count} ungelesene Benachrichtigungen, die älter als 24 Stunden sind:

]]>
{PAGE_TITLE|language}

You can disable only this type of notification as well.

]]>
+ getUser()->username}, + +you currently have got {#$notifications|count} unread notifications that are older than 24 hours:]]> + Hallo {@$mailbox->getUser()->username}, + +

you currently have got {#$notifications|count} unread notifications that are older than 24 hours:

]]>