]> git.mxchange.org Git - friendica.git/commitdiff
forumlist - mark selected forum as selected
authorrabuzarus <>
Sat, 28 Nov 2015 22:52:12 +0000 (23:52 +0100)
committerrabuzarus <>
Sat, 28 Nov 2015 22:52:12 +0000 (23:52 +0100)
include/forums.php
mod/network.php
view/templates/widget_forumlist.tpl
view/theme/duepuntozero/style.css
view/theme/frost-mobile/style.css
view/theme/frost/style.css
view/theme/quattro/templates/widget_forumlist.tpl [new file with mode: 0644]
view/theme/vier/style.css
view/theme/vier/templates/widget_forumlist_right.tpl
view/theme/vier/theme.php

index 59bf5a6b079af9a32d935bcf19b17186b8292a53..995a29cad1411d0ec6280068ac9bfca52d1b00e1 100644 (file)
@@ -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,
                        );
index fd22f3e192f7d0d9a8fa7f272b462c9cce9bdd4f..f18e3001d0dcab4548c31386c57309b04e7caaa1 100644 (file)
@@ -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);
index 54d7df82d219cdd0da068913dc32626f87210e58..32da71f816633b51fc3d08ad4bfa683238847714 100644 (file)
@@ -24,7 +24,7 @@ function showHideForumlist() {
                        <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
                                <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
                        </a>
-                       <a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
+                       <a class="forum-widget-link {{if $forum.selected}}forum-selected{{/if}}" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
                </li>
                {{/if}}
        
@@ -34,7 +34,7 @@ function showHideForumlist() {
                        <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
                                <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
                        </a>
-                       <a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
+                       <a class="forum-widget-link {{if $forum.selected}}forum-selected{{/if}}" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
                </li>
                {{/if}}
                {{/foreach}}
index 255a1d089ab606e56eb37e63e08b713c0cbac2f0..cbf0410359dbdc6a4145a67732ae83f9f24c37d2 100644 (file)
@@ -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;
index 4485c056ffedea5c70dc09acf25bdfb19799d38e..9a0c50e1e7aeb56aa757dfa9ec0b21ba7a86daa1 100644 (file)
@@ -511,7 +511,7 @@ footer {
        margin-bottom: 10px;\r
 }\r
 \r
-.group-selected, .nets-selected, .fileas-selected, .categories-selected {\r
+.group-selected, .nets-selected, .fileas-selected, .categories-selected, .forum-selected {\r
        padding: 3px;\r
        -moz-border-radius: 3px;\r
        -webkit-border-radius: 3px;\r
index 24fe47559a47acb804cc53eea92fc39fb884ffa6..c0e85facb01ba342981c589ebc9fc11592a2c0c5 100644 (file)
@@ -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 (file)
index 0000000..35c54bc
--- /dev/null
@@ -0,0 +1,46 @@
+<script>
+
+function showHideForumlist() {
+       if( $("li[id^='forum-widget-entry-extended-']").is(':visible')) {
+               $("li[id^='forum-widget-entry-extended-']").hide();
+               $("li#forum-widget-collapse").html(window.showMore);
+
+       }
+       else {
+               $("li[id^='forum-widget-entry-extended-']").show();
+               $("li#forum-widget-collapse").html(window.showFewer);
+       }
+}
+</script>
+
+<div id="forumlist-sidebar" class="widget">
+       <h3 id="forumlist">{{$title}}</h3>
+
+       <ul id="forumlist-sidbar-ul" role="menu">
+               {{foreach $forums as $forum}}
+               {{if $forum.id <= $visible_forums}}
+               <li class="forum-widget-entry forum-{{$forum.cid}} tool {{if $forum.selected}}selected{{/if}}" id="forum-widget-entry-{{$forum.id}}" role="menuitem">
+                       <span class="notify badge pull-right"></span>
+                       <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
+                               <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
+                       </a>
+                       <a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
+               </li>
+               {{/if}}
+       
+               {{if $forum.id > $visible_forums}}
+               <li class="forum-widget-entry forum-{{$forum.cid}} tool {{if $forum.selected}}selected{{/if}}" id="forum-widget-entry-extended-{{$forum.id}}" role="menuitem" style="display: none;">
+                       <span class="notify badge pull-right"></span>
+                       <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
+                               <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
+                       </a>
+                       <a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
+               </li>
+               {{/if}}
+               {{/foreach}}
+
+               {{if $total > $visible_forums }}
+               <li onclick="showHideForumlist(); return false;" id="forum-widget-collapse" class="forum-widget-link fakelink tool">{{$showmore}}</li>
+               {{/if}}
+       </ul>
+</div>
index 5bd475759fff3d0a7ef4389e27cd4266e1306dc9..fcc6c7b8cc579187657b5a0bcf82b3fc8359dde6 100644 (file)
@@ -435,7 +435,7 @@ code {
 /*  color: #000; */
 }
 
-.group-selected, .nets-selected, .fileas-selected {
+.group-selected, .nets-selected, .fileas-selected, .forum-selected {
   font-weight: bold;
 }
 
index 49e7723e8e1d405eca2d3cb736d0c6967e212b17..93f8e8f105fdf7287342eb93ef66767e17798604 100644 (file)
@@ -20,21 +20,21 @@ function showHideForumlist() {
                {{foreach $forums as $forum}}
                {{if $forum.id <= $visible_forums}}
                <li class="forum-widget-entry forum-{{$forum.cid}}" id="forum-widget-entry-{{$forum.id}}" role="menuitem">
+                       <span class="notify badge pull-right"></span>
                        <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
                                <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
                        </a>
-                       <a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
-                       <span class="notify badge pull-right"></span>
+                       <a class="forum-widget-link {{if $forum.selected}}forum-selected{{/if}}" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
                </li>
                {{/if}}
        
                {{if $forum.id > $visible_forums}}
                <li class="forum-widget-entry forum-{{$forum.cid}}" id="forum-widget-entry-extended-{{$forum.id}}" role="menuitem" style="display: none;">
+                       <span class="notify padge pull-right"></span>
                        <a href="{{$forum.external_url}}" title="{{$forum.link_desc}}" class="label sparkle" target="_blank">
                                <img class="forumlist-img" src="{{$forum.micro}}" alt="{{$forum.link_desc}}" />
                        </a>
-                       <a class="forum-widget-link" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
-                       <span class="notify padge pull-right"></span>
+                       <a class="forum-widget-link {{if $forum.selected}}forum-selected{{/if}}" id="forum-widget-link-{{$forum.id}}" href="{{$forum.url}}" >{{$forum.name}}</a>
                </li>
                {{/if}}
                {{/foreach}}
index 789ba1daf1cabdca0567eced5d4ac5f110a7e5b5..91c384f805d1692253879f31a7bdb4dd3e0ef540 100644 (file)
@@ -222,6 +222,9 @@ function vier_community_info() {
 
                require_once('include/forums.php');
 
+               if(x($_GET['cid']) && intval($_GET['cid']) != 0)
+                       $cid = $_GET['cid'];
+
                //sort by last updated item
                $lastitem = true;
 
@@ -235,11 +238,14 @@ function vier_community_info() {
 
                        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,
                                );