common_tabs in notifications.php

This commit is contained in:
Fabio Comuni 2011-10-10 17:01:14 +02:00
parent e9eb15373f
commit 906addf865
2 changed files with 22 additions and 16 deletions

View file

@ -63,6 +63,17 @@ function notifications_content(&$a) {
return; return;
} }
$notif_tpl = get_markup_template('notifications.tpl');
$tabs = array(
'net' => array('label' => t('Network'), 'url'=>$a->get_baseurl().'/notifications/network', 'sel'=>''),
'home' => array('label' => t('Home'), 'url'=>$a->get_baseurl().'/notifications/home', 'sel'=>''),
'intros'=> array('label' => t('Introductions'), 'url'=>$a->get_baseurl().'/notifications/intros', 'sel'=>''),
'msg' => array('label' => t('Messages'), 'url'=>$a->get_baseurl().'/message', 'sel'=>''),
);
$o = ''; $o = '';
if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) { if( (($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
@ -72,7 +83,7 @@ function notifications_content(&$a) {
else else
$sql_extra = " AND `ignore` = 0 "; $sql_extra = " AND `ignore` = 0 ";
$notif_tpl = get_markup_template('notifications.tpl');
$notif_content .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >' $notif_content .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/intros/all' : 'notifications/intros' ) . '" id="notifications-show-hide-link" >'
. ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n"; . ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
@ -164,11 +175,12 @@ function notifications_content(&$a) {
} }
} }
else else
info( t('No notifications.') . EOL); $notif_content .= t('<p>No notifications.</p>');
$tabs['intros']['sel']='active';
$o .= replace_macros($notif_tpl,array( $o .= replace_macros($notif_tpl,array(
'$notif_content' => $notif_content, '$notif_content' => $notif_content,
'$activetab' => 'intros' '$tabs' => $tabs,
)); ));
$o .= paginate($a); $o .= paginate($a);
@ -176,7 +188,6 @@ function notifications_content(&$a) {
} else if (($a->argc > 1) && ($a->argv[1] == 'network')) { } else if (($a->argc > 1) && ($a->argv[1] == 'network')) {
$notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
@ -251,14 +262,14 @@ function notifications_content(&$a) {
$notif_content = t('Nothing new!'); $notif_content = t('Nothing new!');
} }
$tabs['net']['sel']='active';
$o .= replace_macros($notif_tpl,array( $o .= replace_macros($notif_tpl,array(
'$notif_content' => $notif_content, '$notif_content' => $notif_content,
'$activetab' => 'network' '$tabs' => $tabs,
)); ));
} else if (($a->argc > 1) && ($a->argv[1] == 'home')) { } else if (($a->argc > 1) && ($a->argv[1] == 'home')) {
$notif_tpl = get_markup_template('notifications.tpl');
$r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`, $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`author-name`,
`item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object` as `object`,
@ -326,9 +337,10 @@ function notifications_content(&$a) {
$notif_content = t('Nothing new!'); $notif_content = t('Nothing new!');
} }
$tabs['home']['sel'] = 'active';
$o .= replace_macros($notif_tpl,array( $o .= replace_macros($notif_tpl,array(
'$notif_content' => $notif_content, '$notif_content' => $notif_content,
'$activetab' => 'home' '$tabs' => $tabs,
)); ));
} }

View file

@ -1,13 +1,7 @@
<h1>Notifications</h1> <h1>Notifications</h1>
<p id="notification-listing-desc"> {{ inc common_tabs.tpl }}{{ endinc }}
<a href="/notifications/network" class="button tabs {{if $activetab==network}}active{{endif}}">Network</a>
<a href="/notifications/home" class="button tabs {{if $activetab==home}}active{{endif}}">Home</a>
<a href="/notifications/intros" class="button tabs {{if $activetab==intros}}active{{endif}}">Introductions</a>
<a href="/message" class="button tabs">Messages</a>
</p>
<div class="notification-listing-end"></div>
<div class="notif-network-wrapper"> <div class="notif-network-wrapper">
$notif_content $notif_content