From 5de7d0f12f279aed4551d261d8f71325ca01028a Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 23 Jun 2011 11:30:17 +0200 Subject: add profile tabs to "photos", "events" and "notes". in dispy, show active tab. --- mod/events.php | 17 ++++++++++++++++- mod/notes.php | 14 ++++++++++++++ mod/photos.php | 34 +++++++++++++++++++++++++--------- mod/profile.php | 5 +++-- view/profile_tabs.tpl | 6 +++--- view/theme/dispy/profile_tabs.tpl | 10 ++++++---- view/theme/dispy/style.css | 1 + 7 files changed, 68 insertions(+), 19 deletions(-) diff --git a/mod/events.php b/mod/events.php index 156b464ba..642da3cb7 100644 --- a/mod/events.php +++ b/mod/events.php @@ -103,8 +103,23 @@ function events_content(&$a) { return; } + $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 .= '

' . t('Events') . '

'; + $mode = 'view'; $y = 0; $m = 0; @@ -318,4 +333,4 @@ function events_content(&$a) { return $o; } -} \ No newline at end of file +} diff --git a/mod/notes.php b/mod/notes.php index 0f980ff67..9f1a4662d 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -36,6 +36,20 @@ function notes_content(&$a) { $contact = $a->contact; $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 .= '

' . t('Personal Notes') . '

'; diff --git a/mod/photos.php b/mod/photos.php index e52f67008..bbdb8b7e9 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -80,15 +80,15 @@ EOT; function photos_post(&$a) { -logger('mod/photos.php: photos_post(): begin' , 'LOGGER_DEBUG'); + logger('mod/photos.php: photos_post(): begin' , 'LOGGER_DEBUG'); -foreach($_REQUEST AS $key => $val) { - logger('mod/photos.php: photos_post(): $_REQUEST key: ' . $key . ' val: ' . $val , 'LOGGER_DEBUG'); -} + foreach($_REQUEST AS $key => $val) { + logger('mod/photos.php: photos_post(): $_REQUEST key: ' . $key . ' val: ' . $val , 'LOGGER_DEBUG'); + } -foreach($_FILES AS $key => $val) { - logger('mod/photos.php: photos_post(): $_FILES key: ' . $key . ' val: ' . $val , 'LOGGER_DEBUG'); -} + foreach($_FILES AS $key => $val) { + logger('mod/photos.php: photos_post(): $_FILES key: ' . $key . ' val: ' . $val , 'LOGGER_DEBUG'); + } $can_post = false; $visitor = 0; @@ -836,6 +836,22 @@ 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", + )); + // // dispatch request // @@ -968,7 +984,7 @@ function photos_content(&$a) { - $o = ''; + //$o = ''; // fetch image, item containing image, then comments $ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' @@ -1319,7 +1335,7 @@ function photos_content(&$a) { } // Default - show recent photos with upload link (if applicable) - $o = ''; + //$o = ''; $r = q("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' $sql_extra GROUP BY `resource-id`", diff --git a/mod/profile.php b/mod/profile.php index 587ac6288..f2dd7f4df 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -116,8 +116,9 @@ function profile_content(&$a, $update = 0) { '$status' => t('Status'), '$profile' => t('Profile'), '$photos' => t('Photos'), - '$events' => (($is_owner) ? '' . t('Events') . '' : ''), - '$notes' => (($is_owner) ? '' . t('Personal Notes') . '' : '') + '$events' => (($is_owner) ? t('Events') : ''), + '$notes' => (($is_owner) ? t('Personal Notes') : ''), + '$activetab' => $tab, )); diff --git a/view/profile_tabs.tpl b/view/profile_tabs.tpl index 3628ff5ff..7820013b6 100644 --- a/view/profile_tabs.tpl +++ b/view/profile_tabs.tpl @@ -3,7 +3,7 @@ $status $profile $photos - $events - $notes + {{ if $events }}$events{{ endif }} + {{ if $notes }}$notes{{ endif }}
- \ No newline at end of file + diff --git a/view/theme/dispy/profile_tabs.tpl b/view/theme/dispy/profile_tabs.tpl index 63b6d48dd..c236490b2 100644 --- a/view/theme/dispy/profile_tabs.tpl +++ b/view/theme/dispy/profile_tabs.tpl @@ -1,7 +1,9 @@
- $status - $profile - $photos + $status + $profile + $photos + {{ if $events }}$events{{ endif }} + {{ if $notes }}$notes{{ endif }}
-
\ No newline at end of file + diff --git a/view/theme/dispy/style.css b/view/theme/dispy/style.css index 34c880ac0..e0f5a46fb 100644 --- a/view/theme/dispy/style.css +++ b/view/theme/dispy/style.css @@ -371,6 +371,7 @@ section { margin: 10px 11% 0px 11%; font-size: 0.8em; padding-right: 230px;} .tabs-wrapper li { display: inline;} .tabs { padding: 0px 5px; margin-right: 10px; } .tabs:hover { background-color: #729fcf; color: #eeeeec; border: 0px; } +.tabs.active { background-color: #729fcf; color: #eeeeec; border: 0px; } /** -- cgit v1.2.3