From 0c3979720f0a2509cbc50662b4eba992ff81af13 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 23 Oct 2015 00:12:00 +0200 Subject: [PATCH] template rework: rearrange sidebar widgets for contact related pages --- mod/contacts.php | 16 +++++++++------- mod/directory.php | 4 ++-- mod/dirfind.php | 4 ++-- mod/match.php | 2 +- mod/suggest.php | 2 +- view/templates/contacts-widget-sidebar.tpl | 2 +- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/mod/contacts.php b/mod/contacts.php index bdb25b022b..3ace870904 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -27,6 +27,9 @@ function contacts_init(&$a) { require_once('include/group.php'); require_once('include/contact_widgets.php'); + if ($_GET['nets'] == "all") + $_GET['nets'] = ""; + if(! x($a->page,'aside')) $a->page['aside'] = ''; @@ -35,29 +38,28 @@ function contacts_init(&$a) { $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( '$name' => htmlentities($a->data['contact']['name']), '$photo' => $a->data['contact']['photo'], - '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] + '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? $a->get_baseurl()."/redir/".$a->data['contact']['id'] : $a->data['contact']['url'] )); $follow_widget = ''; + $networks_widget = ''; } else { $vcard_widget = ''; + $networks_widget .= networks_widget('contacts',$_GET['nets']); if (isset($_GET['add'])) $follow_widget = follow_widget($_GET['add']); else $follow_widget = follow_widget(); } - if ($_GET['nets'] == "all") - $_GET['nets'] = ""; - - $groups_widget .= group_side('contacts','group',false,0,$contact_id); $findpeople_widget .= findpeople_widget(); - $networks_widget .= networks_widget('contacts',$_GET['nets']); + $groups_widget .= group_side('contacts','group',false,0,$contact_id); + $a->page['aside'] .= replace_macros(get_markup_template("contacts-widget-sidebar.tpl"),array( '$vcard_widget' => $vcard_widget, + '$findpeople_widget' => $findpeople_widget, '$follow_widget' => $follow_widget, '$groups_widget' => $groups_widget, - '$findpeople_widget' => $findpeople_widget, '$networks_widget' => $networks_widget )); diff --git a/mod/directory.php b/mod/directory.php index 8ed4c22007..ef80b082a4 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -6,10 +6,10 @@ function directory_init(&$a) { if(local_user()) { require_once('include/contact_widgets.php'); - $a->page['aside'] .= follow_widget(); - $a->page['aside'] .= findpeople_widget(); + $a->page['aside'] .= follow_widget(); + } else { unset($_SESSION['theme']); diff --git a/mod/dirfind.php b/mod/dirfind.php index 77e86c5db3..bbd3badebf 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -13,9 +13,9 @@ function dirfind_init(&$a) { if(! x($a->page,'aside')) $a->page['aside'] = ''; - $a->page['aside'] .= follow_widget(); - $a->page['aside'] .= findpeople_widget(); + + $a->page['aside'] .= follow_widget(); } diff --git a/mod/match.php b/mod/match.php index f6174da66c..5da1e036c3 100644 --- a/mod/match.php +++ b/mod/match.php @@ -19,8 +19,8 @@ function match_content(&$a) { if(! local_user()) return; - $a->page['aside'] .= follow_widget(); $a->page['aside'] .= findpeople_widget(); + $a->page['aside'] .= follow_widget(); $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; diff --git a/mod/suggest.php b/mod/suggest.php index 5241e485ee..8870c65df8 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -61,8 +61,8 @@ function suggest_content(&$a) { $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; - $a->page['aside'] .= follow_widget(); $a->page['aside'] .= findpeople_widget(); + $a->page['aside'] .= follow_widget(); $r = suggestion_query(local_user()); diff --git a/view/templates/contacts-widget-sidebar.tpl b/view/templates/contacts-widget-sidebar.tpl index 5c52f4329a..5b0610fcbd 100644 --- a/view/templates/contacts-widget-sidebar.tpl +++ b/view/templates/contacts-widget-sidebar.tpl @@ -1,7 +1,7 @@ {{$vcard_widget}} +{{$findpeople_widget}} {{$follow_widget}} {{$groups_widget}} -{{$findpeople_widget}} {{$networks_widget}}