From f64e2d63b9ee66482b3461ecb6ee8f7776e23b87 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 10 Oct 2011 15:28:34 +0200 Subject: New common tab template. Update css --- mod/events.php | 12 +----- mod/network.php | 126 +++++++++++++++++++++++++++++-------------------------- mod/notes.php | 14 +------ mod/photos.php | 12 +----- mod/profile.php | 15 ++----- mod/settings.php | 18 ++++++-- 6 files changed, 87 insertions(+), 110 deletions(-) (limited to 'mod') diff --git a/mod/events.php b/mod/events.php index 5bc9807ed..fb68d53db 100644 --- a/mod/events.php +++ b/mod/events.php @@ -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 .= '

' . t('Events') . '

'; diff --git a/mod/network.php b/mod/network.php index f0e9e4441..9b7c4e611 100644 --- a/mod/network.php +++ b/mod/network.php @@ -42,66 +42,7 @@ function network_init(&$a) { ); } - // item filter tabs - // TODO: fix this logic, reduce duplication - $a->page['content'] .= '
'; - - $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'] .= '' - . t('All') . ''; - - // new - $a->page['content'] .= '' - . t('New') . ''; - - // starred - $a->page['content'] .= '' - . t('Starred') . ''; - - // bookmarks - $a->page['content'] .= '' - . t('Bookmarks') . ''; - - $a->page['content'] .= '
'; - // --- 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'] .= '
'; + + $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; diff --git a/mod/notes.php b/mod/notes.php index 369f120a7..94ea10e81 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -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 .= '

' . t('Personal Notes') . '

'; diff --git a/mod/photos.php b/mod/photos.php index 1321af192..623b15a93 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -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 diff --git a/mod/profile.php b/mod/profile.php index 50bbdd46e..9da0784d3 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -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 .= '' . t('Tips for New Members') . '' . EOL; diff --git a/mod/settings.php b/mod/settings.php index 44ebdd77b..7112db887 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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, )); -- cgit v1.2.3