New common tab template. Update css

This commit is contained in:
Fabio Comuni 2011-10-10 15:28:34 +02:00
parent 077726a193
commit f64e2d63b9
25 changed files with 173 additions and 215 deletions

View file

@ -112,17 +112,7 @@ function events_content(&$a) {
$o ="";
// tabs
$tpl = get_markup_template('profile_tabs.tpl');
$o .= replace_macros($tpl,array(
'$url' => $a->get_baseurl() . '/profile/' . $a->user['nickname'],
'$phototab' => $a->get_baseurl() . '/photos/' . $a->user['nickname'],
'$status' => t('Status'),
'$profile' => t('Profile'),
'$photos' => t('Photos'),
'$events' => t('Events') ,
'$notes' => t('Personal Notes'),
'$activetab' => "events",
));
$o .= profile_tabs($a, True);
$o .= '<h2>' . t('Events') . '</h2>';

View file

@ -42,66 +42,7 @@ function network_init(&$a) {
);
}
// item filter tabs
// TODO: fix this logic, reduce duplication
$a->page['content'] .= '<div class="tabs-wrapper">';
$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';
}
// network links moved to content to match other pages
// all
// added 'button' class for easier styling - not the best place for it, should be moved into the tpl like profile_tabs.tpl
// once there is a network_tabs.tpl or something
$a->page['content'] .= '<a class="button tabs ' . $all_active . '" href="' . $a->get_baseurl() . '/'
. str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . '">'
. t('All') . '</a>';
// new
$a->page['content'] .= '<a class="button tabs ' . $new_active . '" href="' . $a->get_baseurl() . '/'
. str_replace('/new', '', $a->cmd) . '/new'
. ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">'
. t('New') . '</a>';
// starred
$a->page['content'] .= '<a class="button tabs ' . $starred_active . '" href="' . $a->get_baseurl() . '/'
. str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '&star=1" >'
. t('Starred') . '</a>';
// bookmarks
$a->page['content'] .= '<a class="button tabs ' . $bookmarked_active . '" href="' . $a->get_baseurl() . '/'
. str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '&bmark=1" >'
. t('Bookmarks') . '</a>';
$a->page['content'] .= '</div>';
// --- end item filter tabs
// search terms header
if(x($_GET,'search')) {
@ -157,6 +98,71 @@ function network_content(&$a, $update = 0) {
$o = '';
// item filter tabs
// TODO: fix this logic, reduce duplication
$a->page['content'] .= '<div class="tabs-wrapper">';
$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;

View file

@ -38,19 +38,7 @@ function notes_content(&$a,$update = false) {
$is_owner = true;
$o ="";
// tabs
$tpl = get_markup_template('profile_tabs.tpl');
$o .= replace_macros($tpl,array(
'$url' => $a->get_baseurl() . '/profile/' . $a->user['nickname'],
'$phototab' => $a->get_baseurl() . '/photos/' . $a->user['nickname'],
'$status' => t('Status'),
'$profile' => t('Profile'),
'$photos' => t('Photos'),
'$events' => t('Events') ,
'$notes' => t('Personal Notes'),
'$activetab' => "notes",
));
$o .= profile_tabs($a,True);
if(! $update) {
$o .= '<h3>' . t('Personal Notes') . '</h3>';

View file

@ -831,18 +831,8 @@ function photos_content(&$a) {
$o = "";
// tabs
$tpl = get_markup_template('profile_tabs.tpl');
$_is_owner = (local_user() && (local_user() == $owner_uid));
$o .= replace_macros($tpl,array(
'$url' => $a->get_baseurl() . '/profile/' .$a->data['user']['nickname'],
'$phototab' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'],
'$status' => t('Status'),
'$profile' => t('Profile'),
'$photos' => t('Photos'),
'$events' => (($_is_owner) ? t('Events') : ''),
'$notes' => (($_is_owner) ? t('Personal Notes') : ''),
'$activetab' => "photos",
));
$o .= profile_tabs($a,$_is_owner);
//
// dispatch request

View file

@ -110,18 +110,7 @@ function profile_content(&$a, $update = 0) {
if(x($_GET,'tab'))
$tab = notags(trim($_GET['tab']));
$tpl = get_markup_template('profile_tabs.tpl');
$o .= replace_macros($tpl,array(
'$url' => $a->get_baseurl() . '/' . $a->cmd,
'$phototab' => $a->get_baseurl() . '/photos/' . $a->profile['nickname'],
'$status' => t('Status'),
'$profile' => t('Profile'),
'$photos' => t('Photos'),
'$events' => (($is_owner) ? t('Events') : ''),
'$notes' => (($is_owner) ? t('Personal Notes') : ''),
'$activetab' => $tab,
));
$o.=profile_tabs($a, $is_owner);
if($tab === 'profile') {
@ -131,6 +120,8 @@ function profile_content(&$a, $update = 0) {
return $o;
}
if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
$o .= '<a href="newmember">' . t('Tips for New Members') . '</a>' . EOL;

View file

@ -306,10 +306,22 @@ function settings_content(&$a) {
return;
}
$tabtpl = get_markup_template("settings_tabs.tpl");
$tabs = array(
array(
'label' => t('Account settings'),
'url' => $a->get_baseurl().'/settings',
'sel' => (($a->argc == 1)?'active':''),
),
array(
'label' => t('Plugin settings'),
'url' => $a->get_baseurl().'/settings/addon',
'sel' => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
)
);
$tabtpl = get_markup_template("common_tabs.tpl");
$tabs = replace_macros($tabtpl, array(
'$account' => array( t('Account settings'), $a->get_baseurl().'/settings'),
'$plugins' => array( t('Plugin settings'), $a->get_baseurl().'/settings/addon')
'$tabs' => $tabs,
));