From b8186ba98bfdd8a366d7ee2a491df040bb5a70c2 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Thu, 14 Jun 2018 17:05:23 +0200 Subject: [PATCH 1/3] Frio: provide a template for received contact suggestions --- mod/notifications.php | 17 ++++++++++++---- src/Core/NotificationsManager.php | 8 ++++++-- view/templates/suggestions.tpl | 2 +- view/theme/frio/css/style.css | 2 +- view/theme/frio/templates/intros.tpl | 24 ++++++++++++++--------- view/theme/frio/templates/suggestions.tpl | 2 ++ 6 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 view/theme/frio/templates/suggestions.tpl diff --git a/mod/notifications.php b/mod/notifications.php index f7f40d1d2..c583425e8 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -164,14 +164,22 @@ function notifications_content(App $a) { switch ($it['label']) { case 'friend_suggestion': $notif_content[] = replace_macros($sugg, [ - '$str_notifytype' => L10n::t('Notification type: '), + '$type' => $it['label'], + '$str_notifytype' => L10n::t('Notification type:'), '$notify_type' => $it['notify_type'], '$intro_id' => $it['intro_id'], - '$madeby' => L10n::t('suggested by %s', $it['madeby']), - '$contact_id' => $it['contact-id'], + '$lbl_madeby' => L10n::t('Suggested by:'), + '$madeby' => $it['madeby'], + '$madeby_url' => $it['madeby_url'], + '$madeby_zrl' => $it['madeby_zrl'], + '$madeby_addr' => $it['madeby_addr'], + '$contact_id' => $it['contact_id'], '$photo' => $it['photo'], '$fullname' => $it['name'], '$url' => $it['url'], + '$zrl' => $it['zrl'], + '$lbl_url' => L10n::t('Profile URL'), + '$addr' => $it['addr'], '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''], '$knowyou' => $it['knowyou'], @@ -232,8 +240,9 @@ function notifications_content(App $a) { } $notif_content[] = replace_macros($tpl, [ + '$type' => $it['label'], '$header' => htmlentities($header), - '$str_notifytype' => L10n::t('Notification type: '), + '$str_notifytype' => L10n::t('Notification type:'), '$notify_type' => $it['notify_type'], '$dfrn_text' => $dfrn_text, '$dfrn_id' => $it['dfrn_id'], diff --git a/src/Core/NotificationsManager.php b/src/Core/NotificationsManager.php index 6e9d469eb..8a1c1569e 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Core/NotificationsManager.php @@ -775,7 +775,7 @@ class NotificationsManager extends BaseObject /// @todo Fetch contact details by "Contact::getDetailsByUrl" instead of queries to contact, fcontact and gcontact $r = q( "SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, - `fcontact`.`name` AS `fname`, `fcontact`.`url` AS `furl`, + `fcontact`.`name` AS `fname`, `fcontact`.`url` AS `furl`, `fcontact`.`addr` AS `faddr`, `fcontact`.`photo` AS `fphoto`, `fcontact`.`request` AS `frequest`, `gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`, `gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`, @@ -825,10 +825,14 @@ class NotificationsManager extends BaseObject 'notify_type' => L10n::t('Friend Suggestion'), 'intro_id' => $it['intro_id'], 'madeby' => $it['name'], + 'madeby_url' => $it['url'], + 'madeby_zrl' => Contact::magicLink($it['url']), + 'madeby_addr' => $it['addr'], 'contact_id' => $it['contact-id'], 'photo' => ((x($it, 'fphoto')) ? proxy_url($it['fphoto'], false, PROXY_SIZE_SMALL) : "images/person-175.jpg"), 'name' => $it['fname'], - 'url' => Contact::magicLink($it['furl']), + 'url' => $it['furl'], + 'zrl' => Contact::magicLink($it['furl']), 'hidden' => $it['hidden'] == 1, 'post_newfriend' => (intval(PConfig::get(local_user(), 'system', 'post_newfriend')) ? '1' : 0), 'knowyou' => $knowyou, diff --git a/view/templates/suggestions.tpl b/view/templates/suggestions.tpl index 9be529cf7..edc0dbdba 100644 --- a/view/templates/suggestions.tpl +++ b/view/templates/suggestions.tpl @@ -3,7 +3,7 @@

{{$str_notifytype}} {{$notify_type}}

-
{{$madeby}}
+{{if $madeby}}
{{$lbl_madeby}} {{$madeby}}
{{/if}}
{{$fullname}}
{{$fullname|escape:'html'}}
{{$note}}
diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index b4bb84cca..c324524cd 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2815,7 +2815,7 @@ ul.notif-network-list > li:hover .intro-action-buttons { } .intro-desc-label, .intro-url-label, .intro-network-label, .intro-location-label, .intro-gender-label, .intro-keywords-label, -.intro-about-label, .intro-knowyou-label { +.intro-about-label, .intro-knowyou-label, .intro-madeby-label { font-weight: bold; } .intro-contact-info.xs .intro-url-label, .intro-contact-info.xs .intro-network-label, diff --git a/view/theme/frio/templates/intros.tpl b/view/theme/frio/templates/intros.tpl index c153fcd9f..df46e453a 100644 --- a/view/theme/frio/templates/intros.tpl +++ b/view/theme/frio/templates/intros.tpl @@ -1,15 +1,17 @@ -
+{{* template incomming contact request and suggested contacts *}} + +
{{* Contact Photo *}}
{{* The intro actions like approve, ignore, discard intro*}} -
{{$str_notifytype}}{{$notify_type}}
+
{{$str_notifytype}} {{$notify_type}}
+ {{* if the contact was suggestested by another contact, the contact who made the suggestion is displayed*}} + {{if $madeby}}
{{$lbl_madeby}} {{$madeby}}
{{/if}} {{* Additional information of the contact *}} {{* Additional information of the contact for mobile view *}} @@ -40,19 +44,21 @@ {{if $keywords}}
{{$lbl_keywords}}{{$keywords}}
{{/if}} {{if $about}}
{{$lbl_about}}{{$about}}
{{/if}}
{{$lbl_knowyou}}{{$knowyou}}
-
{{$note}}
+
{{$note}}
{{* This sections contains special settings for contact approval. We hide it by default and load this section in a bootstrap modal in the case of approval *}} -