diff options
-rw-r--r-- | boot.php | 4 | ||||
-rw-r--r-- | database.sql | 8 | ||||
-rw-r--r-- | include/group.php | 2 | ||||
-rw-r--r-- | include/text.php | 4 | ||||
-rw-r--r-- | mod/network.php | 46 | ||||
-rw-r--r-- | update.php | 14 | ||||
-rw-r--r-- | view/theme/duepuntozero/style.css | 18 | ||||
-rw-r--r-- | view/theme/loozah/style.css | 19 |
8 files changed, 108 insertions, 7 deletions
@@ -7,9 +7,9 @@ require_once('include/text.php'); require_once("include/pgettext.php"); -define ( 'FRIENDIKA_VERSION', '2.2.1092' ); +define ( 'FRIENDIKA_VERSION', '2.2.1093' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1085 ); +define ( 'DB_UPDATE_VERSION', 1086 ); define ( 'EOL', "<br />\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/database.sql b/database.sql index 432ce7693..343d4c497 100644 --- a/database.sql +++ b/database.sql @@ -613,3 +613,11 @@ CREATE TABLE IF NOT EXISTS `deliverq` ( `item` INT NOT NULL , `contact` INT NOT NULL ) ENGINE = MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `search` ( +`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , +`uid` INT NOT NULL , +`term` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, +INDEX ( `uid` ), +INDEX ( `term` ) +) ENGINE = MyISAM DEFAULT CHARSET=utf8; diff --git a/include/group.php b/include/group.php index cd89739e1..8798adf5a 100644 --- a/include/group.php +++ b/include/group.php @@ -170,7 +170,7 @@ EOT; $selected = (($group_id == $rr['id']) ? ' class="group-selected" ' : ''); $o .= ' <li class="sidebar-group-li">' . (($edit) ? "<a href=\"group/{$rr['id']}\" title=\"" . t('Edit') - . "\" ><img src=\"images/spencil.gif\" alt=\"" . t('Edit') . "\"></a> " : "") + . "\" class=\"groupsideedit\" ><img src=\"images/spencil.gif\" alt=\"" . t('Edit') . "\"></a> " : "") . (($cid) ? '<input type="checkbox" class="' . (($selected) ? 'ticked' : 'unticked') . '" onclick="contactgroupChangeMember(' . $rr['id'] . ',' . $cid . ');return true;" ' . ((in_array($rr['id'],$member_of)) ? ' checked="checked" ' : '') . '/>' : '') . "<a href=\"$each/{$rr['id']}\" class=\"sidebar-group-element\" $selected >{$rr['name']}</a></li>\r\n"; diff --git a/include/text.php b/include/text.php index 66447069e..e3d984a1f 100644 --- a/include/text.php +++ b/include/text.php @@ -602,12 +602,14 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) { if(! function_exists('search')) { -function search($s,$id='search-box',$url='/search') { +function search($s,$id='search-box',$url='/search',$save = false) { $a = get_app(); $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') . '" />'; + if($save) + $o .= '<input type="submit" name="save" id="search-save" value="' . t('Save') . '" />'; $o .= '</form></div>'; return $o; }} diff --git a/mod/network.php b/mod/network.php index 54fb2a0a4..663814ab7 100644 --- a/mod/network.php +++ b/mod/network.php @@ -16,8 +16,26 @@ function network_init(&$a) { $search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : ''); $srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : ''); + if(x($_GET,'save')) { + $r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1", + intval(local_user()), + dbesc($search) + ); + if(! count($r)) { + q("insert into `search` ( `uid`,`term` ) values ( %d, '%s') ", + intval(local_user()), + dbesc($search) + ); + } + } + if(x($_GET,'remove')) { + q("delete from `search` where `uid` = %d and `term` = '%s' limit 1", + intval(local_user()), + dbesc($search) + ); + } - $a->page['aside'] .= search($search,'netsearch-box',$srchurl); + $a->page['aside'] .= search($search,'netsearch-box',$srchurl,true); $a->page['aside'] .= '<div id="network-new-link">'; @@ -49,9 +67,35 @@ function network_init(&$a) { $a->page['aside'] .= '</div>'; $a->page['aside'] .= group_side('network','network',true,$group_id); + + $a->page['aside'] .= saved_searches(); + +} + +function saved_searches() { + + $o = ''; + + $r = q("select `term` from `search` WHERE `uid` = %d", + intval(local_user()) + ); + + if(count($r)) { + $o .= '<h3>' . t('Saved Searches') . '</h3>' . "\r\n"; + $o .= '<div id="saved-search-list"><ul id="saved-search-ul">' . "\r\n"; + foreach($r as $rr) { + $o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . $rr['term'] . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n"; + } + $o .= '</ul></div>' . "\r\n"; + } + + return $o; + } + + function network_content(&$a, $update = 0) { require_once('include/conversation.php'); diff --git a/update.php b/update.php index 80761cce4..3d7b31813 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1085 ); +define( 'UPDATE_VERSION' , 1086 ); /** * @@ -704,10 +704,20 @@ function update_1083() { `cmd` CHAR( 32 ) NOT NULL , `item` INT NOT NULL , `contact` INT NOT NULL - ) ENGINE = MYISAM ;"); + ) ENGINE = MYISAM "); } function update_1084() { q("ALTER TABLE `contact` ADD `attag` CHAR( 255 ) NOT NULL AFTER `nick` "); } + +function update_1085() { + q("CREATE TABLE IF NOT EXISTS `search` ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , + `uid` INT NOT NULL , + `term` CHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, + INDEX ( `uid` ), + INDEX ( `term` ) + ) ENGINE = MYISAM "); +} diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index fb7380e02..d1b85bf7a 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -1811,6 +1811,24 @@ a.mail-list-link { margin-top: 10px; } +#search-save { + margin-left: 5px; +} +.groupsideedit { + margin-right: 10px; +} +#saved-search-ul { + list-style-type: none; +} +.savedsearchdrop, .savedsearchterm { + float: left; + margin-top: 10px; +} +.savedsearchterm { + margin-left: 10px; +} + + #side-follow-wrapper { margin-top: 20px; } diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css index 50b780e97..b97f27510 100644 --- a/view/theme/loozah/style.css +++ b/view/theme/loozah/style.css @@ -1871,6 +1871,25 @@ a.mail-list-link { margin-top: 10px; } + +#search-save { + margin-left: 5px; +} +.groupsideedit { + margin-right: 10px; +} +#saved-search-ul { + list-style-type: none; +} +.savedsearchdrop, .savedsearchterm { + float: left; + margin-top: 10px; +} +.savedsearchterm { + margin-left: 10px; +} + + #side-follow-wrapper { margin-top: 20px; } |