]> git.mxchange.org Git - friendica.git/commitdiff
network select widget
authorfriendica <info@friendica.com>
Fri, 6 Jan 2012 04:40:48 +0000 (20:40 -0800)
committerfriendica <info@friendica.com>
Fri, 6 Jan 2012 04:40:48 +0000 (20:40 -0800)
include/contact_widgets.php
mod/network.php
view/nets.tpl [new file with mode: 0644]
view/theme/duepuntozero/style.css
view/theme/loozah/style.css
view/theme/testbubble/style.css

index 3a21ff2c6ff54edab709686c32a30ab7e5c1de33..424f2997ef1610e4bd17ef46e8ec42f3ba05f73b 100644 (file)
@@ -40,3 +40,36 @@ function findpeople_widget() {
 }
 
 
+function networks_widget($baseurl,$selected = '') {
+
+       $a = get_app();
+
+       if(! local_user())
+               return '';
+
+       
+       $r = q("select distinct(network) from contact where uid = %d",
+               intval(local_user())
+       );
+
+       $nets = array();
+       if(count($r)) {
+               require_once('include/contact_selectors.php');
+               foreach($r as $rr) {
+                               if($rr['network'])
+                                       $nets[] = array('ref' => $rr['network'], 'name' => network_to_name($rr['network']), 'selected' => (($selected == $rr['network']) ? 'selected' : '' ));
+               }
+       }
+
+       return replace_macros(get_markup_template('nets.tpl'),array(
+               '$title' => t('Networks'),
+               '$desc' => '',
+               '$sel_all' => (($selected == '') ? 'selected' : ''),
+               '$all' => t('All Networks'),
+               '$nets' => $nets,
+               '$base' => $baseurl,
+
+       ));
+}
+
+
index 76c7bb5e695108ecac1dbfe9b6c785469531a0d5..9318d20ca01fc9bacfdeb47c0027b8438bd0dc51 100644 (file)
@@ -10,6 +10,8 @@ function network_init(&$a) {
        $group_id = (($a->argc > 1 && intval($a->argv[1])) ? intval($a->argv[1]) : 0);
                  
        require_once('include/group.php');
+       require_once('include/contact_widgets.php');
+
        if(! x($a->page,'aside'))
                $a->page['aside'] = '';
 
@@ -42,6 +44,7 @@ function network_init(&$a) {
        }
        
        $a->page['aside'] .= group_side('network','network',true,$group_id);
+       $a->page['aside'] .= networks_widget($a->get_baseurl() . '/network',(($_GET['nets']) ? $_GET['nets'] : ''));
        $a->page['aside'] .= saved_searches($search);
 
 }
diff --git a/view/nets.tpl b/view/nets.tpl
new file mode 100644 (file)
index 0000000..b0cb889
--- /dev/null
@@ -0,0 +1,10 @@
+<div id="nets-sidebar" class="widget">
+       <h3>$title</h3>
+       <div id="nets-desc">$desc</div>
+       <a href="$base" class="nets-link{{ if $sel_all }} nets-selected{{ endif }} nets-all">$all</a>
+       <ul class="nets-ul">
+       {{ for $nets as $net }}
+       <li><a href="$base?nets=$net.ref" class="nets-link{{ if $net.selected }} nets-selected{{ endif }}">$net.name</a></li>
+       {{ endfor }}
+       </ul>
+</div>
index 6ce4c52c05e768dfdf5c1415b89c54c04e2018ae..6fa968da36fefe9192a6d04e179655f7b7320ce8 100644 (file)
@@ -300,7 +300,7 @@ div.wall-item-content-wrapper.shiny {
        margin-bottom: 10px;
 }
 
-.group-selected {
+.group-selected, .nets-selected {
        padding: 3px;
        -moz-border-radius: 3px;
        border-radius: 3px;     
@@ -1836,6 +1836,21 @@ a.mail-list-link {
        margin-top: 10px;
 }
 
+.nets-ul {
+       list-style-type: none;
+}
+
+.nets-ul li {
+       margin-top: 10px;
+}
+
+.nets-link {
+       margin-left: 24px;
+}
+.nets-all {
+       margin-left: 42px;
+}
+
 #search-save {
        margin-left: 5px;
 }
index 6b8aef500bde7ad4eb0eaac12a874e0682e59ddf..ff31a7807487baa52ce1b744f22a8e57fdac21e1 100644 (file)
@@ -164,7 +164,7 @@ blockquote:before {
     margin-bottom: 10px;
 }
 
-.group-selected {
+.group-selected, .nets-selected {
     padding: 3px;
     border: 1px solid #CCCCCC;
     background: #F8F8F8;
@@ -1901,6 +1901,21 @@ a.mail-list-link {
        width: 12px;
 }
 
+.nets-ul {
+       list-style-type: none;
+}
+
+.nets-ul li {
+       margin-top: 10px;
+}
+
+.nets-link {
+       margin-left: 24px;
+}
+.nets-all {
+       margin-left: 42px;
+}
+
 #search-save {
     margin-left: 5px;
 }
index 3a5d9f178808a9c18c3c4ab49b06f0cfdf6cbe28..54bbdeb980948da353344dab6cf358443346019f 100644 (file)
@@ -630,7 +630,7 @@ h3#search:before {
        top:1px;
 }
 
-.group-selected {
+.group-selected, .nets-selected {
        padding-bottom: 0px;
        padding-left: 2px;
        padding-right: 2px;
@@ -668,6 +668,23 @@ ul .sidebar-group-li .icon{
        width: 12px;
 }
 
+
+.nets-ul {
+       list-style-type: none;
+}
+
+.nets-ul li {
+       margin-top: 10px;
+}
+
+.nets-link {
+       margin-left: 24px;
+}
+.nets-all {
+       margin-left: 42px;
+}
+
+
 .widget h3{
        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f0edf0), color-stop(1, #e2e2e2) );
        background:-moz-linear-gradient( center top, #f0edf0 5%, #e2e2e2 100% );