From f5597da059b126b6910cfeee7f5d154fa49cdf0b Mon Sep 17 00:00:00 2001
From: rabuzarus <>
Date: Sat, 28 Nov 2015 23:52:12 +0100
Subject: [PATCH] forumlist - mark selected forum as selected
---
include/forums.php | 15 ++++--
mod/network.php | 4 +-
view/templates/widget_forumlist.tpl | 4 +-
view/theme/duepuntozero/style.css | 2 +-
view/theme/frost-mobile/style.css | 2 +-
view/theme/frost/style.css | 2 +-
.../quattro/templates/widget_forumlist.tpl | 46 +++++++++++++++++++
view/theme/vier/style.css | 2 +-
.../vier/templates/widget_forumlist_right.tpl | 8 ++--
view/theme/vier/theme.php | 10 +++-
10 files changed, 77 insertions(+), 18 deletions(-)
create mode 100644 view/theme/quattro/templates/widget_forumlist.tpl
diff --git a/include/forums.php b/include/forums.php
index 59bf5a6b0..995a29cad 100644
--- a/include/forums.php
+++ b/include/forums.php
@@ -60,10 +60,12 @@ function get_forumlist($uid, $showhidden = true, $lastitem, $showprivate = false
* Sidebar widget to show subcribed friendica forums. If activated
* in the settings, it appears at the notwork page sidebar
*
- * @param App $a
+ * @param int $uid
+ * @param int $cid
+ * The contact id which is used to mark a forum as "selected"
* @return string
*/
-function widget_forumlist($a) {
+function widget_forumlist($uid,$cid = 0) {
if(! intval(feature_enabled(local_user(),'forumlist_widget')))
return;
@@ -73,7 +75,7 @@ function widget_forumlist($a) {
//sort by last updated item
$lastitem = true;
- $contacts = get_forumlist($a->user['uid'],true,$lastitem, true);
+ $contacts = get_forumlist($uid,true,$lastitem, true);
$total = count($contacts);
$visible_forums = 10;
@@ -83,11 +85,14 @@ function widget_forumlist($a) {
foreach($contacts as $contact) {
+ $selected = (($cid == $contact['id']) ? ' forum-selected' : '');
+
$entry = array(
- 'url' => $a->get_baseurl() . '/network?f=&cid=' . $contact['id'],
- 'external_url' => $a->get_baseurl() . '/redir/' . $contact['id'],
+ 'url' => z_root() . '/network?f=&cid=' . $contact['id'],
+ 'external_url' => z_root() . '/redir/' . $contact['id'],
'name' => $contact['name'],
'cid' => $contact['id'],
+ 'selected' => $selected,
'micro' => proxy_url($contact['micro'], false, PROXY_SIZE_MICRO),
'id' => ++$id,
);
diff --git a/mod/network.php b/mod/network.php
index fd22f3e19..f18e3001d 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -6,6 +6,8 @@ function network_init(&$a) {
}
$is_a_date_query = false;
+ if(x($_GET['cid']) && intval($_GET['cid']) != 0)
+ $cid = $_GET['cid'];
if($a->argc > 1) {
for($x = 1; $x < $a->argc; $x ++) {
@@ -146,7 +148,7 @@ function network_init(&$a) {
}
$a->page['aside'] .= (feature_enabled(local_user(),'groups') ? group_side('network/0','network','standard',$group_id) : '');
- $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist($a) : '');
+ $a->page['aside'] .= (feature_enabled(local_user(),'forumlist_widget') ? widget_forumlist(local_user(),$cid) : '');
$a->page['aside'] .= posted_date_widget($a->get_baseurl() . '/network',local_user(),false);
$a->page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : ''));
$a->page['aside'] .= saved_searches($search);
diff --git a/view/templates/widget_forumlist.tpl b/view/templates/widget_forumlist.tpl
index 54d7df82d..32da71f81 100644
--- a/view/templates/widget_forumlist.tpl
+++ b/view/templates/widget_forumlist.tpl
@@ -24,7 +24,7 @@ function showHideForumlist() {
- {{$forum.name}}
+ {{$forum.name}}
{{/if}}
@@ -34,7 +34,7 @@ function showHideForumlist() {
- {{$forum.name}}
+ {{$forum.name}}
{{/if}}
{{/foreach}}
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css
index 255a1d089..cbf041035 100644
--- a/view/theme/duepuntozero/style.css
+++ b/view/theme/duepuntozero/style.css
@@ -340,7 +340,7 @@ div.wall-item-content-wrapper.shiny {
margin-bottom: 10px;
}
-.group-selected, .nets-selected, .fileas-selected, .categories-selected {
+.group-selected, .nets-selected, .fileas-selected, .categories-selected, .forum-selected {
padding: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
diff --git a/view/theme/frost-mobile/style.css b/view/theme/frost-mobile/style.css
index 4485c056f..9a0c50e1e 100644
--- a/view/theme/frost-mobile/style.css
+++ b/view/theme/frost-mobile/style.css
@@ -511,7 +511,7 @@ footer {
margin-bottom: 10px;
}
-.group-selected, .nets-selected, .fileas-selected, .categories-selected {
+.group-selected, .nets-selected, .fileas-selected, .categories-selected, .forum-selected {
padding: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
diff --git a/view/theme/frost/style.css b/view/theme/frost/style.css
index 24fe47559..c0e85facb 100644
--- a/view/theme/frost/style.css
+++ b/view/theme/frost/style.css
@@ -489,7 +489,7 @@ div.wall-item-content-wrapper.shiny {
margin-bottom: 10px;
}
-.group-selected, .nets-selected, .fileas-selected, .categories-selected {
+.group-selected, .nets-selected, .fileas-selected, .categories-selected, .forum-selected {
padding: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
diff --git a/view/theme/quattro/templates/widget_forumlist.tpl b/view/theme/quattro/templates/widget_forumlist.tpl
new file mode 100644
index 000000000..35c54bc69
--- /dev/null
+++ b/view/theme/quattro/templates/widget_forumlist.tpl
@@ -0,0 +1,46 @@
+
+
+