]> git.mxchange.org Git - friendica.git/commitdiff
add profile tabs to "photos", "events" and "notes". in dispy, show active tab.
authorFabio Comuni <fabrix.xm@gmail.com>
Thu, 23 Jun 2011 09:30:17 +0000 (11:30 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Thu, 23 Jun 2011 09:30:17 +0000 (11:30 +0200)
mod/events.php
mod/notes.php
mod/photos.php
mod/profile.php
view/profile_tabs.tpl
view/theme/dispy/profile_tabs.tpl
view/theme/dispy/style.css

index 156b464ba7d7f0150b480458dcf737695896f7ab..642da3cb75318b0380f81723122205f1419c0249 100644 (file)
@@ -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 .= '<h2>' . t('Events') . '</h2>';
 
+
        $mode = 'view';
        $y = 0;
        $m = 0;
@@ -318,4 +333,4 @@ function events_content(&$a) {
 
                return $o;
        }
-}
\ No newline at end of file
+}
index 0f980ff67fda92a0dd27cbc32bb5ba0368239850..9f1a4662da968d5f4a844af6dc5560142be53ef8 100644 (file)
@@ -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 .= '<h3>' . t('Personal Notes') . '</h3>';
index e52f67008ff33457855b59910a2a528f5458139f..bbdb8b7e9ecaef43598aff9c1d611732af929f8e 100644 (file)
@@ -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`",
index 587ac6288e7b1cfa60b7a5dded955091bddf6a95..f2dd7f4dfa327571aadc516152e1577030c612df 100644 (file)
@@ -116,8 +116,9 @@ function profile_content(&$a, $update = 0) {
                        '$status' => t('Status'),
                        '$profile' => t('Profile'),
                        '$photos' => t('Photos'),
-                       '$events' => (($is_owner) ?     '<a href="events" id="profile-tab-events-link" class="profile-tabs" >' . t('Events') . '</a>' : ''),
-                       '$notes' => (($is_owner) ?      '<a href="notes" id="profile-tab-notes-link" class="profile-tabs" >' . t('Personal Notes') . '</a>' : '')
+                       '$events' => (($is_owner) ? t('Events') : ''),
+                       '$notes' => (($is_owner) ?      t('Personal Notes') : ''),
+                       '$activetab' => $tab,
                ));
 
 
index 3628ff5ff0316aa613d600f2463c6b122a4600ab..7820013b606a1b1ccf74251462886ace0b57c23f 100644 (file)
@@ -3,7 +3,7 @@
        <a href="$url" id="profile-tab-status-link" class="profile-tabs" >$status</a>
        <a href="$url?tab=profile" id="profile-tab-profile-link" class="profile-tabs" >$profile</a>
        <a href="$phototab" id="profile-tab-photos-link" class="profile-tabs" >$photos</a>
-       $events
-       $notes
+       {{ if $events }}<a href="events" id="profile-tab-events-link" class="profile-tabs" >$events</a>{{ endif }}
+       {{ if $notes }}<a href="notes" id="profile-tab-notes-link" class="profile-tabs" >$notes</a>{{ endif }}
 <div id="profile-tabs-end"></div>
-</div>
\ No newline at end of file
+</div>
index 63b6d48dd27df94fc97853eb8635afd13fc4adc3..c236490b285e70f5d6e441b7e24bd00aeb19263d 100644 (file)
@@ -1,7 +1,9 @@
 
 <div class="tabs-wrapper" >
-       <a href="$url" id="profile-tab-status-link" class="tabs" >$status</a>
-       <a href="$url?tab=profile" id="profile-tab-profile-link" class="tabs" >$profile</a>
-       <a href="$phototab" id="profile-tab-photos-link" class="tabs" >$photos</a>
+       <a href="$url" id="profile-tab-status-link" class="tabs {{if $activetab==posts}}active{{endif}}" >$status</a>
+       <a href="$url?tab=profile" id="profile-tab-profile-link" class="tabs {{if $activetab==profile}}active{{endif}}" >$profile</a>
+       <a href="$phototab" id="profile-tab-photos-link" class="tabs {{if $activetab==photos}}active{{endif}}" >$photos</a>
+       {{ if $events }}<a href="events" id="profile-tab-events-link" class="tabs {{if $activetab==events}}active{{endif}}" >$events</a>{{ endif }}
+       {{ if $notes }}<a href="notes" id="profile-tab-notes-link" class="tabs {{if $activetab==notes}}active{{endif}}" >$notes</a>{{ endif }}  
 <div class="tabs-end"></div>
-</div>
\ No newline at end of file
+</div>
index 34c880ac07e794355cf2a5dce182283f186d22f5..e0f5a46fbd3d8e5fc6f161e409d5d77c161de5cf 100644 (file)
@@ -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; }
 
 
 /**