tabs have now an ID

This commit is contained in:
rabuzarus 2015-10-24 15:04:27 +02:00
parent 64a5b33e77
commit 87ecd8f658
2 changed files with 51 additions and 31 deletions

View File

@ -550,6 +550,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block', 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/block',
'sel' => '', 'sel' => '',
'title' => t('Toggle Blocked status'), 'title' => t('Toggle Blocked status'),
'id' => 'toggle-block-tab',
'accesskey' => 'b', 'accesskey' => 'b',
), ),
array( array(
@ -557,6 +558,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore', 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/ignore',
'sel' => '', 'sel' => '',
'title' => t('Toggle Ignored status'), 'title' => t('Toggle Ignored status'),
'id' => 'toggle-ignore-tab',
'accesskey' => 'i', 'accesskey' => 'i',
), ),
@ -565,6 +567,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/archive', 'url' => $a->get_baseurl(true) . '/contacts/' . $contact_id . '/archive',
'sel' => '', 'sel' => '',
'title' => t('Toggle Archive status'), 'title' => t('Toggle Archive status'),
'id' => 'toggle-archive-tab',
'accesskey' => 'v', 'accesskey' => 'v',
), ),
array( array(
@ -572,6 +575,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id, 'url' => $a->get_baseurl(true) . '/crepair/' . $contact_id,
'sel' => '', 'sel' => '',
'title' => t('Advanced Contact Settings'), 'title' => t('Advanced Contact Settings'),
'id' => 'repair-tab',
'accesskey' => 'r', 'accesskey' => 'r',
) )
); );
@ -693,6 +697,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/suggest', 'url' => $a->get_baseurl(true) . '/suggest',
'sel' => '', 'sel' => '',
'title' => t('Suggest potential friends'), 'title' => t('Suggest potential friends'),
'id' => 'suggestions-tab',
'accesskey' => 'g', 'accesskey' => 'g',
), ),
array( array(
@ -700,6 +705,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/all', 'url' => $a->get_baseurl(true) . '/contacts/all',
'sel' => ($all) ? 'active' : '', 'sel' => ($all) ? 'active' : '',
'title' => t('Show all contacts'), 'title' => t('Show all contacts'),
'id' => 'showall-tab',
'accesskey' => 'l', 'accesskey' => 'l',
), ),
array( array(
@ -707,6 +713,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts', 'url' => $a->get_baseurl(true) . '/contacts',
'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '', 'sel' => ((! $all) && (! $blocked) && (! $hidden) && (! $search) && (! $nets) && (! $ignored) && (! $archived)) ? 'active' : '',
'title' => t('Only show unblocked contacts'), 'title' => t('Only show unblocked contacts'),
'id' => 'showunblocked-tab',
'accesskey' => 'o', 'accesskey' => 'o',
), ),
@ -715,6 +722,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/blocked', 'url' => $a->get_baseurl(true) . '/contacts/blocked',
'sel' => ($blocked) ? 'active' : '', 'sel' => ($blocked) ? 'active' : '',
'title' => t('Only show blocked contacts'), 'title' => t('Only show blocked contacts'),
'id' => 'showblocked-tab',
'accesskey' => 'b', 'accesskey' => 'b',
), ),
@ -723,6 +731,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/ignored', 'url' => $a->get_baseurl(true) . '/contacts/ignored',
'sel' => ($ignored) ? 'active' : '', 'sel' => ($ignored) ? 'active' : '',
'title' => t('Only show ignored contacts'), 'title' => t('Only show ignored contacts'),
'id' => 'showignored-tab',
'accesskey' => 'i', 'accesskey' => 'i',
), ),
@ -731,6 +740,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/archived', 'url' => $a->get_baseurl(true) . '/contacts/archived',
'sel' => ($archived) ? 'active' : '', 'sel' => ($archived) ? 'active' : '',
'title' => t('Only show archived contacts'), 'title' => t('Only show archived contacts'),
'id' => 'showarchived-tab',
'accesskey' => 'y', 'accesskey' => 'y',
), ),
@ -739,6 +749,7 @@ function contacts_content(&$a) {
'url' => $a->get_baseurl(true) . '/contacts/hidden', 'url' => $a->get_baseurl(true) . '/contacts/hidden',
'sel' => ($hidden) ? 'active' : '', 'sel' => ($hidden) ? 'active' : '',
'title' => t('Only show hidden contacts'), 'title' => t('Only show hidden contacts'),
'id' => 'showhidden-tab',
'accesskey' => 'h', 'accesskey' => 'h',
), ),

View File

@ -119,19 +119,19 @@ function network_init(&$a) {
$search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : ''); $search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
if(x($_GET,'save')) { if(x($_GET,'save')) {
$r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1", $r = q("SELECT * FROM `search` WHERE `uid` = %d AND `term` = '%s' LIMIT 1",
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
); );
if(! count($r)) { if(! count($r)) {
q("insert into `search` ( `uid`,`term` ) values ( %d, '%s') ", q("INSERT INTO `search` ( `uid`,`term` ) VALUES ( %d, '%s') ",
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
); );
} }
} }
if(x($_GET,'remove')) { if(x($_GET,'remove')) {
q("delete from `search` where `uid` = %d and `term` = '%s'", q("DELETE FROM `search` WHERE `uid` = %d AND `term` = '%s'",
intval(local_user()), intval(local_user()),
dbesc($search) dbesc($search)
); );
@ -172,7 +172,7 @@ function saved_searches($search) {
$o = ''; $o = '';
$r = q("select `id`,`term` from `search` WHERE `uid` = %d", $r = q("SELECT `id`,`term` FROM `search` WHERE `uid` = %d",
intval(local_user()) intval(local_user())
); );
@ -355,57 +355,63 @@ function network_content(&$a, $update = 0) {
// tabs // tabs
$tabs = array( $tabs = array(
array( array(
'label' => t('Commented Order'), 'label' => t('Commented Order'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=comment' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
'sel'=>$all_active, 'sel' => $all_active,
'title'=> t('Sort by Comment Date'), 'title' => t('Sort by Comment Date'),
'id' => 'commented-order-tab',
'accesskey' => "e", 'accesskey' => "e",
), ),
array( array(
'label' => t('Posted Order'), 'label' => t('Posted Order'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . '?f=&order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''),
'sel'=>$postord_active, 'sel' => $postord_active,
'title' => t('Sort by Post Date'), 'title' => t('Sort by Post Date'),
'id' => 'posted-order-tab',
'accesskey' => "t", 'accesskey' => "t",
), ),
); );
if(feature_enabled(local_user(),'personal_tab')) { if(feature_enabled(local_user(),'personal_tab')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Personal'), 'label' => t('Personal'),
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1', 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&conv=1',
'sel' => $conv_active, 'sel' => $conv_active,
'title' => t('Posts that mention or involve you'), 'title' => t('Posts that mention or involve you'),
'id' => 'personal-tab',
'accesskey' => "r", 'accesskey' => "r",
); );
} }
if(feature_enabled(local_user(),'new_tab')) { if(feature_enabled(local_user(),'new_tab')) {
$tabs[] = array( $tabs[] = array(
'label' => t('New'), 'label' => t('New'),
'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''), 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ($len_naked_cmd ? '/' : '') . 'new' . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : ''),
'sel' => $new_active, 'sel' => $new_active,
'title' => t('Activity Stream - by date'), 'title' => t('Activity Stream - by date'),
'id' => 'activitiy-by-date-tab',
'accesskey' => "w", 'accesskey' => "w",
); );
} }
if(feature_enabled(local_user(),'link_tab')) { if(feature_enabled(local_user(),'link_tab')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Shared Links'), 'label' => t('Shared Links'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1', 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&bmark=1',
'sel'=>$bookmarked_active, 'sel' => $bookmarked_active,
'title'=> t('Interesting Links'), 'title' => t('Interesting Links'),
'id' => 'shared-links-tab',
'accesskey' => "b", 'accesskey' => "b",
); );
} }
if(feature_enabled(local_user(),'star_posts')) { if(feature_enabled(local_user(),'star_posts')) {
$tabs[] = array( $tabs[] = array(
'label' => t('Starred'), 'label' => t('Starred'),
'url'=>$a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1', 'url' => $a->get_baseurl(true) . '/' . str_replace('/new', '', $cmd) . ((x($_GET,'cid')) ? '/?f=&cid=' . $_GET['cid'] : '/?f=') . '&star=1',
'sel'=>$starred_active, 'sel' => $starred_active,
'title' => t('Favourite Posts'), 'title' => t('Favourite Posts'),
'id' => 'starred-posts-tab',
'accesskey' => "m", 'accesskey' => "m",
); );
} }
@ -446,7 +452,7 @@ function network_content(&$a, $update = 0) {
$def_acl = array('allow_cid' => '<' . intval($cid) . '>'); $def_acl = array('allow_cid' => '<' . intval($cid) . '>');
if($nets) { if($nets) {
$r = q("select id from contact where uid = %d and network = '%s' and self = 0", $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND network = '%s' AND `self` = 0",
intval(local_user()), intval(local_user()),
dbesc($nets) dbesc($nets)
); );
@ -475,7 +481,10 @@ function network_content(&$a, $update = 0) {
$content = ""; $content = "";
if ($cid) { if ($cid) {
$contact = q("SELECT `nick` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `forum`", intval($cid), intval(local_user())); $contact = q("SELECT `nick` FROM `contact` WHERE `id` = %d AND `uid` = %d AND `forum`",
intval($cid),
intval(local_user())
);
if ($contact) if ($contact)
$content = "@".$contact[0]["nick"]."+".$cid; $content = "@".$contact[0]["nick"]."+".$cid;
} }
@ -569,7 +578,7 @@ function network_content(&$a, $update = 0) {
); );
if(count($r)) { if(count($r)) {
$sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item` $sql_post_table = " INNER JOIN (SELECT DISTINCT(`parent`) FROM `item`
WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." and deleted = 0 WHERE 1 $sql_options AND `contact-id` = ".intval($cid)." AND `deleted` = 0
ORDER BY `item`.`received` DESC) AS `temp1` ORDER BY `item`.`received` DESC) AS `temp1`
ON $sql_table.$sql_parent = `temp1`.`parent` "; ON $sql_table.$sql_parent = `temp1`.`parent` ";
$sql_extra = ""; $sql_extra = "";