X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fnetwork.php;h=9b7c4e6112778dffae3435133b6f26ab5290af26;hb=906addf865ccab2c98d5035fc6c1b10d43004dfe;hp=dd22e7d5b5295cca8ef8abf1e65e8f9a0812634a;hpb=7ea6b0a1264ec0c1cdb18a82b6a4f11e570f0e83;p=friendica.git diff --git a/mod/network.php b/mod/network.php index dd22e7d5b5..9b7c4e6112 100644 --- a/mod/network.php +++ b/mod/network.php @@ -17,12 +17,12 @@ function network_init(&$a) { // We need a better way of managing a growing argument list - $srchurl = '/network' - . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') - . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '') - . ((x($_GET,'order')) ? '?order=' . $_GET['order'] : '') - . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : ''); - + // moved into savedsearches() + // $srchurl = '/network' + // . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') + // . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '') + // . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : ''); + if(x($_GET,'save')) { $r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1", intval(local_user()), @@ -42,76 +42,53 @@ function network_init(&$a) { ); } - $a->page['aside'] .= search($search,'netsearch-box',$srchurl,true); - - $a->page['aside'] .= ''; - - if(x($_GET,'star')) - $a->page['aside'] .= ''; - else - $a->page['aside'] .= ''; - - if(! $_GET['bmark']) - $a->page['aside'] .= ''; - + + // search terms header + if(x($_GET,'search')) { + $a->page['content'] .= '

Search Results For: ' . $search . '

'; } - - $a->page['aside'] .= ''; - + $a->page['aside'] .= group_side('network','network',true,$group_id); + + // moved to saved searches to have it in the same div + //$a->page['aside'] .= search($search,'netsearch-box',$srchurl,true); - $a->page['aside'] .= saved_searches(); + $a->page['aside'] .= saved_searches($search); } -function saved_searches() { +function saved_searches($search) { + $srchurl = '/network' + . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') + . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '') + . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : ''); + $o = ''; $r = q("select `term` from `search` WHERE `uid` = %d", intval(local_user()) ); + $o .= '
'; + $o .= '' . "\r\n"; + $o .= search($search,'netsearch-box',$srchurl,true); + if(count($r)) { - $o .= '

' . t('Saved Searches') . '

' . "\r\n"; - $o .= '
' . "\r\n"; + $o .= ''; } + $o .= '
' . "\r\n"; return $o; } - - function network_content(&$a, $update = 0) { require_once('include/conversation.php'); @@ -121,6 +98,71 @@ function network_content(&$a, $update = 0) { $o = ''; + // item filter tabs + // TODO: fix this logic, reduce duplication + $a->page['content'] .= '
'; + + $starred_active = ''; + $new_active = ''; + $bookmarked_active = ''; + $all_active = ''; + $search_active = ''; + + if(($a->argc > 1 && $a->argv[1] === 'new') + || ($a->argc > 2 && $a->argv[2] === 'new')) { + $new_active = 'active'; + } + + if(x($_GET,'search')) { + $search_active = 'active'; + } + + if(x($_GET,'star')) { + $starred_active = 'active'; + } + + if($_GET['bmark']) { + $bookmarked_active = 'active'; + } + + if (($new_active == '') + && ($starred_active == '') + && ($bookmarked_active == '') + && ($search_active == '')) { + $all_active = 'active'; + } + + // tabs + $tabs = array( + array( + 'label' => t('All'), + 'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : ''), + 'sel'=>$all_active, + ), + array( + 'label' => t('New'), + 'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : ''), + 'sel' => $new_active, + ), + array( + 'label' => t('Starred'), + 'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '&star=1', + 'sel'=>$starred_active, + ), + array( + 'label' => t('Bookmarks'), + 'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '&bmark=1', + 'sel'=>$bookmarked_active, + ), + ); + $tpl = get_markup_template('common_tabs.tpl'); + $o .= replace_macros($tpl, array('$tabs'=>$tabs)); + // --- end item filter tabs + + + + + $contact_id = $a->cid; $group = 0; @@ -162,7 +204,7 @@ function network_content(&$a, $update = 0) { } } - $o .= ''; + nav_set_selected('network'); $_SESSION['return_url'] = $a->cmd; @@ -374,7 +416,6 @@ function network_content(&$a, $update = 0) { if(! $update) { $o .= paginate($a); - $o .= cc_license(); } return $o;