diff --git a/include/NotificationsManager.php b/include/NotificationsManager.php index 2adab59721..611860f9d0 100644 --- a/include/NotificationsManager.php +++ b/include/NotificationsManager.php @@ -198,8 +198,10 @@ class NotificationsManager { * string 'label' => The type of the notification * string 'link' => URL to the source * string 'image' => The avatar image + * string 'url' => The profile url of the contact * string 'text' => The notification text - * string 'when' => Relative date of the notification + * string 'when' => The date of the notification + * string 'ago' => T relative date of the notification * bool 'seen' => Is the notification marked as "seen" */ private function formatNotifs($notifs, $ident = "") { @@ -223,26 +225,32 @@ class NotificationsManager { $default_item_label = 'notify'; $default_item_link = $this->a->get_baseurl(true).'/notify/view/'. $it['id']; $default_item_image = proxy_url($it['photo'], false, PROXY_SIZE_MICRO); + $default_item_url = $it['url']; $default_item_text = strip_tags(bbcode($it['msg'])); - $default_item_when = relative_date($it['date']); + $default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['date'], 'r'); + $default_item_ago = relative_date($it['date']); break; case 'home': $default_item_label = 'comment'; $default_item_link = $this->a->get_baseurl(true).'/display/'.$it['pguid']; $default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO); + $default_item_url = $it['author-link']; $default_item_text = sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname']); - $default_item_when = relative_date($it['created']); + $default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['created'], 'r'); + $default_item_ago = relative_date($it['created']); break; default: $default_item_label = (($it['id'] == $it['parent']) ? 'post' : 'comment'); $default_item_link = $this->a->get_baseurl(true).'/display/'.$it['pguid']; $default_item_image = proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO); + $default_item_url = $it['author-link']; $default_item_text = (($it['id'] == $it['parent']) ? sprintf(t("%s created a new post"), $it['author-name']) : sprintf(t("%s commented on %s's post"), $it['author-name'], $it['pname'])); - $default_item_when = relative_date($it['created']); + $default_item_when = datetime_convert('UTC', date_default_timezone_get(), $it['created'], 'r'); + $default_item_ago = relative_date($it['created']); } @@ -253,8 +261,10 @@ class NotificationsManager { 'label' => 'like', 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), + 'url' => $it['author-link'], 'text' => sprintf(t("%s liked %s's post"), $it['author-name'], $it['pname']), - 'when' => relative_date($it['created']), + 'when' => $default_item_when, + 'ago' => $default_item_ago, 'seen' => $it['seen'] ); break; @@ -264,8 +274,10 @@ class NotificationsManager { 'label' => 'dislike', 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), + 'url' => $it['author-link'], 'text' => sprintf(t("%s disliked %s's post"), $it['author-name'], $it['pname']), - 'when' => relative_date($it['created']), + 'when' => $default_item_when, + 'ago' => $default_item_ago, 'seen' => $it['seen'] ); break; @@ -275,8 +287,10 @@ class NotificationsManager { 'label' => 'attend', 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), + 'url' => $it['author-link'], 'text' => sprintf(t("%s is attending %s's event"), $it['author-name'], $it['pname']), - 'when' => relative_date($it['created']), + 'when' => $default_item_when, + 'ago' => $default_item_ago, 'seen' => $it['seen'] ); break; @@ -286,8 +300,10 @@ class NotificationsManager { 'label' => 'attendno', 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), + 'url' => $it['author-link'], 'text' => sprintf( t("%s is not attending %s's event"), $it['author-name'], $it['pname']), - 'when' => relative_date($it['created']), + 'when' => $default_item_when, + 'ago' => $default_item_ago, 'seen' => $it['seen'] ); break; @@ -297,8 +313,10 @@ class NotificationsManager { 'label' => 'attendmaybe', 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), + 'url' => $it['author-link'], 'text' => sprintf(t("%s may attend %s's event"), $it['author-name'], $it['pname']), - 'when' => relative_date($it['created']), + 'when' => $default_item_when, + 'ago' => $default_item_ago, 'seen' => $it['seen'] ); break; @@ -312,8 +330,10 @@ class NotificationsManager { 'label' => 'friend', 'link' => $this->a->get_baseurl(true).'/display/'.$it['pguid'], 'image' => proxy_url($it['author-avatar'], false, PROXY_SIZE_MICRO), + 'url' => $it['author-link'], 'text' => sprintf(t("%s is now friends with %s"), $it['author-name'], $it['fname']), - 'when' => relative_date($it['created']), + 'when' => $default_item_when, + 'ago' => $default_item_ago, 'seen' => $it['seen'] ); break; @@ -323,8 +343,10 @@ class NotificationsManager { 'label' => $default_item_label, 'link' => $default_item_link, 'image' => $default_item_image, + 'url' => $default_item_url, 'text' => $default_item_text, 'when' => $default_item_when, + 'ago' => $default_item_ago, 'seen' => $it['seen'] ); } @@ -459,7 +481,7 @@ class NotificationsManager { if($seen === 0) $sql_seen = " AND `seen` = 0 "; - $r = q("SELECT `id`, `photo`, `msg`, `date`, `seen` FROM `notify` + $r = q("SELECT `id`, `url`, `photo`, `msg`, `date`, `seen` FROM `notify` WHERE `uid` = %d $sql_seen ORDER BY `date` DESC LIMIT %d, %d ", intval(local_user()), intval($start), @@ -626,9 +648,9 @@ class NotificationsManager { $sql_seen = " AND `item`.`unseen` = 1 "; $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, `item`.`unseen`, - `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`, - `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink`, `pitem`.`guid` as `pguid` - FROM `item` INNER JOIN `item` as `pitem` ON `pitem`.`id`=`item`.`parent` + `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` AS `object`, + `pitem`.`author-name` AS `pname`, `pitem`.`author-link` AS `plink`, `pitem`.`guid` AS `pguid` + FROM `item` INNER JOIN `item` AS `pitem` ON `pitem`.`id`=`item`.`parent` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `item`.`uid` = %d AND `item`.`wall` = 1 $sql_seen diff --git a/mod/notifications.php b/mod/notifications.php index 4c56453350..ed15f14177 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -285,8 +285,10 @@ function notifications_content(&$a) { '$item_label' => $it['label'], '$item_link' => $it['link'], '$item_image' => $it['image'], + '$item_url' => $it['url'], '$item_text' => htmlentities($it['text']), '$item_when' => $it['when'], + '$item_ago' => $it['ago'], '$item_seen' => $it['seen'], )); } diff --git a/view/templates/notifications_attend_item.tpl b/view/templates/notifications_attend_item.tpl index 6add369cb4..adaa539d12 100644 --- a/view/templates/notifications_attend_item.tpl +++ b/view/templates/notifications_attend_item.tpl @@ -1,4 +1,4 @@
- {{$item_text}} {{$item_when}} + {{$item_text}} {{$item_ago}}
\ No newline at end of file diff --git a/view/templates/notifications_comments_item.tpl b/view/templates/notifications_comments_item.tpl index dfa15df280..2550806713 100644 --- a/view/templates/notifications_comments_item.tpl +++ b/view/templates/notifications_comments_item.tpl @@ -1,4 +1,4 @@
- {{$item_text}} {{$item_when}} + {{$item_text}} {{$item_ago}}
\ No newline at end of file diff --git a/view/templates/notifications_dislikes_item.tpl b/view/templates/notifications_dislikes_item.tpl index dfa15df280..2550806713 100644 --- a/view/templates/notifications_dislikes_item.tpl +++ b/view/templates/notifications_dislikes_item.tpl @@ -1,4 +1,4 @@
- {{$item_text}} {{$item_when}} + {{$item_text}} {{$item_ago}}
\ No newline at end of file diff --git a/view/templates/notifications_friends_item.tpl b/view/templates/notifications_friends_item.tpl index dfa15df280..2550806713 100644 --- a/view/templates/notifications_friends_item.tpl +++ b/view/templates/notifications_friends_item.tpl @@ -1,4 +1,4 @@
- {{$item_text}} {{$item_when}} + {{$item_text}} {{$item_ago}}
\ No newline at end of file diff --git a/view/templates/notifications_likes_item.tpl b/view/templates/notifications_likes_item.tpl index 6add369cb4..adaa539d12 100644 --- a/view/templates/notifications_likes_item.tpl +++ b/view/templates/notifications_likes_item.tpl @@ -1,4 +1,4 @@
- {{$item_text}} {{$item_when}} + {{$item_text}} {{$item_ago}}
\ No newline at end of file diff --git a/view/templates/notifications_network_item.tpl b/view/templates/notifications_network_item.tpl index 64395a83d0..a50b2cf2ad 100644 --- a/view/templates/notifications_network_item.tpl +++ b/view/templates/notifications_network_item.tpl @@ -1,4 +1,4 @@
- {{$item_text}} {{$item_when}} + {{$item_text}} {{$item_ago}}
diff --git a/view/templates/notifications_posts_item.tpl b/view/templates/notifications_posts_item.tpl index dfa15df280..2550806713 100644 --- a/view/templates/notifications_posts_item.tpl +++ b/view/templates/notifications_posts_item.tpl @@ -1,4 +1,4 @@
- {{$item_text}} {{$item_when}} + {{$item_text}} {{$item_ago}}
\ No newline at end of file diff --git a/view/templates/notify.tpl b/view/templates/notify.tpl index dfa15df280..2550806713 100644 --- a/view/templates/notify.tpl +++ b/view/templates/notify.tpl @@ -1,4 +1,4 @@
- {{$item_text}} {{$item_when}} + {{$item_text}} {{$item_ago}}
\ No newline at end of file diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 91b6219f17..1c602898e6 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -1882,6 +1882,9 @@ ul.dropdown-menu li:hover { -moz-box-shadow: 0 0 3px #dadada; } +.section-title-wrapper { + overflow: hidden; +} /* Profile-page */ #profile-content-standard, #profile-content-advanced { @@ -2208,7 +2211,7 @@ ul li:hover .contact-wrapper a.contact-action-link:hover { margin-left: 20px; } -/* Notifications */ +/* Intro Notifications */ ul.notif-network-list { margin-left: -15px; margin-right: -15px; @@ -2217,17 +2220,12 @@ ul.notif-network-list > li { padding-left: 15px; padding-right: 15px; } -ul.notif-network-list li.unseen { - border-left: 3px solid #f3fcfd; - background-color: #f3fcfd; -} .intro-wrapper.media { overflow: visible; word-wrap: break-word; margin-top: 0; } -.intro-photo-wrapper img.intro-photo, -.notif-item img.notif-image { +.intro-photo-wrapper img.intro-photo { height:80px; width: 80px; border-radius: 4px; @@ -2280,6 +2278,26 @@ ul.notif-network-list > li:hover .intro-action-buttons { margin-top: 5px } +/* Notifications Page */ +ul.notif-network-list li.unseen { + background-color: #f3fcfd; +} +.notif-item img.notif-image { + height: 48px; + width: 48px; + border-radius: 4px; +} +.notif-item .notif-desc-wrapper { + height: 48px; +} +.notif-item .notif-desc-wrapper a { + height: 100%; + display: block; + color: #555; + font-size: 13px; + font-weight: 600; +} + /* Search Page */ /* This is a little bit hacky. Since the search page is used for diferent diff --git a/view/theme/frio/templates/notifications_attend_item.tpl b/view/theme/frio/templates/notifications_attend_item.tpl new file mode 100644 index 0000000000..680b29a27c --- /dev/null +++ b/view/theme/frio/templates/notifications_attend_item.tpl @@ -0,0 +1,2 @@ + +{{include file="notify.tpl"}} diff --git a/view/theme/frio/templates/notifications_comments_item.tpl b/view/theme/frio/templates/notifications_comments_item.tpl new file mode 100644 index 0000000000..680b29a27c --- /dev/null +++ b/view/theme/frio/templates/notifications_comments_item.tpl @@ -0,0 +1,2 @@ + +{{include file="notify.tpl"}} diff --git a/view/theme/frio/templates/notifications_dislikes_item.tpl b/view/theme/frio/templates/notifications_dislikes_item.tpl new file mode 100644 index 0000000000..680b29a27c --- /dev/null +++ b/view/theme/frio/templates/notifications_dislikes_item.tpl @@ -0,0 +1,2 @@ + +{{include file="notify.tpl"}} diff --git a/view/theme/frio/templates/notifications_friends_item.tpl b/view/theme/frio/templates/notifications_friends_item.tpl new file mode 100644 index 0000000000..680b29a27c --- /dev/null +++ b/view/theme/frio/templates/notifications_friends_item.tpl @@ -0,0 +1,2 @@ + +{{include file="notify.tpl"}} diff --git a/view/theme/frio/templates/notifications_likes_item.tpl b/view/theme/frio/templates/notifications_likes_item.tpl new file mode 100644 index 0000000000..680b29a27c --- /dev/null +++ b/view/theme/frio/templates/notifications_likes_item.tpl @@ -0,0 +1,2 @@ + +{{include file="notify.tpl"}} diff --git a/view/theme/frio/templates/notifications_network_item.tpl b/view/theme/frio/templates/notifications_network_item.tpl new file mode 100644 index 0000000000..680b29a27c --- /dev/null +++ b/view/theme/frio/templates/notifications_network_item.tpl @@ -0,0 +1,2 @@ + +{{include file="notify.tpl"}} diff --git a/view/theme/frio/templates/notifications_posts_item.tpl b/view/theme/frio/templates/notifications_posts_item.tpl new file mode 100644 index 0000000000..680b29a27c --- /dev/null +++ b/view/theme/frio/templates/notifications_posts_item.tpl @@ -0,0 +1,2 @@ + +{{include file="notify.tpl"}} diff --git a/view/theme/frio/templates/notify.tpl b/view/theme/frio/templates/notify.tpl new file mode 100644 index 0000000000..6122ecdfbb --- /dev/null +++ b/view/theme/frio/templates/notify.tpl @@ -0,0 +1,12 @@ + +
+
+ +
+
+ + {{$item_text}} +
+
+
+