From 51c9a66fc3d145d6ada187e654f44fdd0ad3125d Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Wed, 21 Dec 2016 20:39:07 +0100 Subject: [PATCH 1/4] frio: add notifications templates to frio --- view/theme/frio/css/style.css | 29 +++++++++++++++---- .../templates/notifications_attend_item.tpl | 2 ++ .../templates/notifications_comments_item.tpl | 2 ++ .../templates/notifications_dislikes_item.tpl | 2 ++ .../templates/notifications_friends_item.tpl | 2 ++ .../templates/notifications_likes_item.tpl | 2 ++ .../templates/notifications_network_item.tpl | 2 ++ .../templates/notifications_posts_item.tpl | 2 ++ view/theme/frio/templates/notify.tpl | 12 ++++++++ 9 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 view/theme/frio/templates/notifications_attend_item.tpl create mode 100644 view/theme/frio/templates/notifications_comments_item.tpl create mode 100644 view/theme/frio/templates/notifications_dislikes_item.tpl create mode 100644 view/theme/frio/templates/notifications_friends_item.tpl create mode 100644 view/theme/frio/templates/notifications_likes_item.tpl create mode 100644 view/theme/frio/templates/notifications_network_item.tpl create mode 100644 view/theme/frio/templates/notifications_posts_item.tpl create mode 100644 view/theme/frio/templates/notify.tpl diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 91b6219f1..efff14a4e 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; @@ -2226,10 +2229,9 @@ ul.notif-network-list li.unseen { word-wrap: break-word; margin-top: 0; } -.intro-photo-wrapper img.intro-photo, -.notif-item img.notif-image { - height:80px; - width: 80px; +.intro-photo-wrapper img.intro-photo { + height:48px; + width: 48px; border-radius: 4px; } .intro-actions { @@ -2280,6 +2282,23 @@ ul.notif-network-list > li:hover .intro-action-buttons { margin-top: 5px } +/* Notifications Page */ +.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 000000000..680b29a27 --- /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 000000000..680b29a27 --- /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 000000000..680b29a27 --- /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 000000000..680b29a27 --- /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 000000000..680b29a27 --- /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 000000000..680b29a27 --- /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 000000000..680b29a27 --- /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 000000000..382ddebe0 --- /dev/null +++ b/view/theme/frio/templates/notify.tpl @@ -0,0 +1,12 @@ + +
+
+ +
+
+ + {{$item_text}} +
+
+
+
From 125d2f24dd8a9946a4b57bbda000bf15f6b0a60c Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Wed, 21 Dec 2016 23:17:55 +0100 Subject: [PATCH 2/4] frio: add profile link to the notifications url --- include/NotificationsManager.php | 19 +++++++++++++++---- mod/notifications.php | 1 + view/theme/frio/css/style.css | 7 +++---- view/theme/frio/templates/notify.tpl | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/NotificationsManager.php b/include/NotificationsManager.php index 2adab5972..610acb93d 100644 --- a/include/NotificationsManager.php +++ b/include/NotificationsManager.php @@ -198,6 +198,7 @@ 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 * bool 'seen' => Is the notification marked as "seen" @@ -223,6 +224,7 @@ 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']); break; @@ -231,6 +233,7 @@ class NotificationsManager { $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']); break; @@ -239,6 +242,7 @@ class NotificationsManager { $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'])); @@ -253,6 +257,7 @@ 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']), 'seen' => $it['seen'] @@ -264,6 +269,7 @@ 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']), 'seen' => $it['seen'] @@ -275,6 +281,7 @@ 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']), 'seen' => $it['seen'] @@ -286,6 +293,7 @@ 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']), 'seen' => $it['seen'] @@ -297,6 +305,7 @@ 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']), 'seen' => $it['seen'] @@ -312,6 +321,7 @@ 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']), 'seen' => $it['seen'] @@ -323,6 +333,7 @@ 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, 'seen' => $it['seen'] @@ -459,7 +470,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 +637,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 3e0bd9cc4..97c009b19 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -285,6 +285,7 @@ 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_seen' => $it['seen'], diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index efff14a4e..5b8b2d9fd 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2220,10 +2220,6 @@ 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; @@ -2283,6 +2279,9 @@ ul.notif-network-list > li:hover .intro-action-buttons { } /* Notifications Page */ +ul.notif-network-list li.unseen { + background-color: #f3fcfd; +} .notif-item img.notif-image { height: 48px; width: 48px; diff --git a/view/theme/frio/templates/notify.tpl b/view/theme/frio/templates/notify.tpl index 382ddebe0..86633bbec 100644 --- a/view/theme/frio/templates/notify.tpl +++ b/view/theme/frio/templates/notify.tpl @@ -1,7 +1,7 @@
- +
From 2fcbba94105a894fb86e2a11c69db6bd4aec55b1 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 22 Dec 2016 00:28:52 +0100 Subject: [PATCH 3/4] provide local time for notifications --- include/NotificationsManager.php | 33 ++++++++++++------- mod/notifications.php | 1 + view/templates/notifications_attend_item.tpl | 2 +- .../templates/notifications_comments_item.tpl | 2 +- .../templates/notifications_dislikes_item.tpl | 2 +- view/templates/notifications_friends_item.tpl | 2 +- view/templates/notifications_likes_item.tpl | 2 +- view/templates/notifications_network_item.tpl | 2 +- view/templates/notifications_posts_item.tpl | 2 +- view/templates/notify.tpl | 2 +- view/theme/frio/templates/notify.tpl | 2 +- 11 files changed, 32 insertions(+), 20 deletions(-) diff --git a/include/NotificationsManager.php b/include/NotificationsManager.php index 610acb93d..611860f9d 100644 --- a/include/NotificationsManager.php +++ b/include/NotificationsManager.php @@ -198,9 +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 '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 = "") { @@ -226,7 +227,8 @@ class NotificationsManager { $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': @@ -235,7 +237,8 @@ class NotificationsManager { $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: @@ -246,7 +249,8 @@ class NotificationsManager { $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']); } @@ -259,7 +263,8 @@ class NotificationsManager { '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; @@ -271,7 +276,8 @@ class NotificationsManager { '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; @@ -283,7 +289,8 @@ class NotificationsManager { '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; @@ -295,7 +302,8 @@ class NotificationsManager { '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; @@ -307,7 +315,8 @@ class NotificationsManager { '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; @@ -323,7 +332,8 @@ class NotificationsManager { '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; @@ -336,6 +346,7 @@ class NotificationsManager { 'url' => $default_item_url, 'text' => $default_item_text, 'when' => $default_item_when, + 'ago' => $default_item_ago, 'seen' => $it['seen'] ); } diff --git a/mod/notifications.php b/mod/notifications.php index 97c009b19..78b26b5d6 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -288,6 +288,7 @@ function notifications_content(&$a) { '$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 6add369cb..adaa539d1 100644 --- a/view/templates/notifications_attend_item.tpl +++ b/view/templates/notifications_attend_item.tpl @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/view/templates/notifications_comments_item.tpl b/view/templates/notifications_comments_item.tpl index dfa15df28..255080671 100644 --- a/view/templates/notifications_comments_item.tpl +++ b/view/templates/notifications_comments_item.tpl @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/view/templates/notifications_dislikes_item.tpl b/view/templates/notifications_dislikes_item.tpl index dfa15df28..255080671 100644 --- a/view/templates/notifications_dislikes_item.tpl +++ b/view/templates/notifications_dislikes_item.tpl @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/view/templates/notifications_friends_item.tpl b/view/templates/notifications_friends_item.tpl index dfa15df28..255080671 100644 --- a/view/templates/notifications_friends_item.tpl +++ b/view/templates/notifications_friends_item.tpl @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/view/templates/notifications_likes_item.tpl b/view/templates/notifications_likes_item.tpl index 6add369cb..adaa539d1 100644 --- a/view/templates/notifications_likes_item.tpl +++ b/view/templates/notifications_likes_item.tpl @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/view/templates/notifications_network_item.tpl b/view/templates/notifications_network_item.tpl index 64395a83d..a50b2cf2a 100644 --- a/view/templates/notifications_network_item.tpl +++ b/view/templates/notifications_network_item.tpl @@ -1,4 +1,4 @@ diff --git a/view/templates/notifications_posts_item.tpl b/view/templates/notifications_posts_item.tpl index dfa15df28..255080671 100644 --- a/view/templates/notifications_posts_item.tpl +++ b/view/templates/notifications_posts_item.tpl @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/view/templates/notify.tpl b/view/templates/notify.tpl index dfa15df28..255080671 100644 --- a/view/templates/notify.tpl +++ b/view/templates/notify.tpl @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/view/theme/frio/templates/notify.tpl b/view/theme/frio/templates/notify.tpl index 86633bbec..6122ecdfb 100644 --- a/view/theme/frio/templates/notify.tpl +++ b/view/theme/frio/templates/notify.tpl @@ -6,7 +6,7 @@
From 747e97a7b29e32c8535c9b2519b3fc84b817d2d2 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 22 Dec 2016 01:54:41 +0100 Subject: [PATCH 4/4] frio: revert img.intro-photo to 80pxx80px --- view/theme/frio/css/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 5b8b2d9fd..1c602898e 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2226,8 +2226,8 @@ ul.notif-network-list > li { margin-top: 0; } .intro-photo-wrapper img.intro-photo { - height:48px; - width: 48px; + height:80px; + width: 80px; border-radius: 4px; } .intro-actions {