diff options
author | Friendika <info@friendika.com> | 2011-05-26 17:47:33 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-05-26 17:47:33 -0700 |
commit | 341f853b042f0f4dcdc5e256c46a25c402d2de2e (patch) | |
tree | cb337a534cad645820a3634fc7e57399d6409f26 | |
parent | 7acb8fa6e7144435b81b57e3ad949846b1cbb68d (diff) | |
download | volse-hubzilla-341f853b042f0f4dcdc5e256c46a25c402d2de2e.tar.gz volse-hubzilla-341f853b042f0f4dcdc5e256c46a25c402d2de2e.tar.bz2 volse-hubzilla-341f853b042f0f4dcdc5e256c46a25c402d2de2e.zip |
search from network page
-rw-r--r-- | boot.php | 6 | ||||
-rw-r--r-- | mod/network.php | 21 | ||||
-rw-r--r-- | view/theme/duepuntozero/style.css | 10 | ||||
-rw-r--r-- | view/theme/loozah/style.css | 8 |
4 files changed, 39 insertions, 6 deletions
@@ -2106,10 +2106,10 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { if(! function_exists('search')) { -function search($s) { +function search($s,$id='search-box',$url='/search') { $a = get_app(); - $o = '<div id="search-box">'; - $o .= '<form action="' . $a->get_baseurl() . '/search' . '" method="get" >'; + $o = '<div id="' . $id . '">'; + $o .= '<form action="' . $a->get_baseurl() . $url . '" method="get" >'; $o .= '<input type="text" name="search" id="search-text" value="' . $s .'" />'; $o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />'; $o .= '</form></div>'; diff --git a/mod/network.php b/mod/network.php index f38fb8c21..75775ba50 100644 --- a/mod/network.php +++ b/mod/network.php @@ -12,10 +12,18 @@ function network_init(&$a) { if(! x($a->page,'aside')) $a->page['aside'] = ''; + $search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : ''); + $srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : ''); + + + $a->page['aside'] .= search($search,'netsearch-box',$srchurl); + $a->page['aside'] .= '<div id="network-new-link">'; - if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) - $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">' . t('Normal View') . '</a>'; + + + if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new') || x($_GET,'search')) + $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . '">' . t('Normal View') . '</a>'; else $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . $a->cmd . '/new' . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">' . t('New Item View') . '</a>'; @@ -55,6 +63,8 @@ function network_content(&$a, $update = 0) { } } + if(x($_GET,'search')) + $nouveau = true; if($cid) $def_acl = array('allow_cid' => '<' . intval($cid) . '>'); @@ -96,7 +106,8 @@ function network_content(&$a, $update = 0) { $o .= '<div id="live-network"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . $_SESSION['uid'] . "; var netargs = '" . substr($a->cmd,8) - . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') + . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') + . ((x($_GET,'search')) ? '?search=' . $_GET['search'] : '') . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; } @@ -169,6 +180,10 @@ function network_content(&$a, $update = 0) { $sql_extra2 = (($nouveau) ? '' : " AND `item`.`parent` = `item`.`id` "); + if(x($_GET,'search')) + $sql_extra .= " AND `item`.`body` REGEXP '" . dbesc(escape_tags($_GET['search'])) . "' "; + + $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 2bac4238e..58cf8646c 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -2394,6 +2394,16 @@ a.mail-list-link { margin: 0px 3px 0px 3px; } + +#netsearch-box { + margin-top: 20px; +} + +#netsearch-box #search-submit { + margin: 5px 0px 0px 0px; +} + + /** * ICONS */ diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css index 9c6c0120b..7c9697b4d 100644 --- a/view/theme/loozah/style.css +++ b/view/theme/loozah/style.css @@ -2411,6 +2411,14 @@ a.mail-list-link { width: 300px; } +#netsearch-box { + margin-top: 20px; +} + +#netsearch-box #search-submit { + margin: 5px 0px 0px 0px; +} + /** * ICONS */ |