set logged in user data server side

This commit is contained in:
Hannes Mannerheim 2015-11-05 12:34:12 +01:00
parent e4cf072027
commit b12bad0ebd
2 changed files with 121 additions and 133 deletions

View File

@ -344,13 +344,18 @@ class QvitterAction extends ApiAction
print $instanceurl.'main/public';
}
?>"><div id="logo"></div></a>
?>"><div id="logo"></div></a><?php
// menu for logged in users
if($logged_in_user) { ?>
<a id="settingslink">
<div class="dropdown-toggle">
<div class="nav-session"></div>
<div class="nav-session" style="background-image:url('<?php print $logged_in_user_obj['profile_image_url_profile_size'] ?>')"></div>
</div>
</a>
<div id="top-compose" class="hidden"></div>
</a><?php
}
?><div id="top-compose" class="hidden"></div>
<ul class="quitter-settings dropdown-menu">
<li class="dropdown-caret right">
<span class="caret-outer"></span>
@ -463,18 +468,21 @@ class QvitterAction extends ApiAction
<button id="signup-btn-step1" class="signup-btn" type="submit"></button>
<div id="other-servers-link"></div>
<div id="qvitter-notice-logged-out"><?php print common_config('site', 'qvitternoticeloggedout'); ?></div>
</div><?php } ?>
<div id="user-header">
</div><?php }
// box containing the logged in users queet count and compose form
if($logged_in_user) { ?>
<div id="user-header" style="background-image:url('<?php print $logged_in_user_obj['cover_photo'] ?>')">
<div id="mini-edit-profile-button"></div>
<div class="profile-header-inner-overlay"></div>
<div id="user-avatar-container"><img id="user-avatar" src="" /></div>
<div id="user-name"></div>
<div id="user-screen-name"></div>
<div id="user-avatar-container"><img id="user-avatar" src="<?php print $logged_in_user_obj['profile_image_url_profile_size'] ?>" /></div>
<div id="user-name"><?php print $logged_in_user_obj['name'] ?></div>
<div id="user-screen-name"><?php print $logged_in_user_obj['screen_name'] ?></div>
</div>
<ul id="user-body">
<li><a id="user-queets"><span class="label"></span><strong></strong></a></li>
<li><a id="user-following"><span class="label"></span><strong></strong></a></li>
<li><a id="user-groups"><span class="label"></span><strong></strong></a></li>
<li><a href="<?php print $instanceurl.$logged_in_user->nickname ?>" id="user-queets"><span class="label"></span><strong><?php print $logged_in_user_obj['statuses_count'] ?></strong></a></li>
<li><a href="<?php print $instanceurl.$logged_in_user->nickname ?>/subscriptions" id="user-following"><span class="label"></span><strong><?php print $logged_in_user_obj['friends_count'] ?></strong></a></li>
<li><a href="<?php print $instanceurl.$logged_in_user->nickname ?>/groups" id="user-groups"><span class="label"></span><strong><?php print $logged_in_user_obj['groups_count'] ?></strong></a></li>
</ul>
<div id="user-footer">
<div id="user-footer-inner">
@ -493,8 +501,10 @@ class QvitterAction extends ApiAction
</div>
</div>
</div>
</div>
<div id="main-menu" class="menu-container"><?php
</div><?php
}
?><div id="main-menu" class="menu-container"><?php
if($logged_in_user) {
?><a href="<?php print $instanceurl.$logged_in_user->nickname ?>/all" class="stream-selection friends-timeline"><i class="chev-right"></i></a>

View File

@ -826,7 +826,6 @@ function proceedToSetLanguageAndLogin(data){
}
else {
display_spinner();
window.currentStream = ''; // force reload stream
setNewCurrentStream(getStreamFromUrl(),true,false,function(){
logoutWithoutReload(false);
remove_spinner();
@ -859,27 +858,7 @@ function doLogin(streamObjectToSet) {
$('#user-container').css('z-index','1000');
$('#top-compose').removeClass('hidden');
$('#qvitter-notice').show();
$('#user-avatar').attr('src', window.loggedIn.profile_image_url_profile_size);
$('#settingslink .nav-session').css('background-image', 'url(\'' + window.loggedIn.profile_image_url_profile_size + '\')');
$('#user-screen-name, #user-avatar, #user-name').attr('data-tooltip', window.sL.viewMyProfilePage);
$('#user-name').append(window.loggedIn.name);
$('#user-screen-name').append(window.loggedIn.screen_name);
$('#user-queets strong').html(window.loggedIn.statuses_count);
$('#user-following strong').html(window.loggedIn.friends_count);
$('#user-followers strong').html(window.loggedIn.followers_count);
$('#user-groups strong').html(window.loggedIn.groups_count);
$('.stream-selection.friends-timeline').attr('href', window.loggedIn.statusnet_profile_url + '/all');
$('.stream-selection.mentions').attr('href', window.loggedIn.statusnet_profile_url + '/replies');
$('.stream-selection.notifications').attr('href', window.loggedIn.statusnet_profile_url + '/notifications');
$('.stream-selection.my-timeline').attr('href', window.loggedIn.statusnet_profile_url);
$('.stream-selection.favorites').attr('href', window.loggedIn.statusnet_profile_url + '/favorites');
$('#user-queets').attr('href',window.loggedIn.statusnet_profile_url);
$('#user-following').attr('href',window.loggedIn.statusnet_profile_url + '/subscriptions');
$('#user-groups').attr('href',window.loggedIn.statusnet_profile_url + '/groups');
window.myUserID = window.loggedIn.id;
if(window.loggedIn.cover_photo !== false) {
$('#user-header').css('background-image','url(\'' + window.loggedIn.cover_photo + '\')');
}
// get all users i'm following for autosuggestion
window.following = new Object();
@ -940,7 +919,6 @@ function doLogin(streamObjectToSet) {
appendAllBookmarks(window.allBookmarks);
// set stream
window.currentStream = ''; // always reload stream on login
setNewCurrentStream(streamObjectToSet,true,false,function(){
$('.language-dropdown').css('display','none');
$('#user-header').animate({opacity:'1'},800);