[Jaws-commits] r12480 - in branches/0.8/html: gadgets/ControlPanel/templates gadgets/Users include/Jaws

afz at jaws-project.com afz at jaws-project.com
Mon Jan 23 08:05:22 UTC 2012


Author: afz
Date: 2012-01-23 08:05:22 +0000 (Mon, 23 Jan 2012)
New Revision: 12480

Modified:
   branches/0.8/html/gadgets/ControlPanel/templates/Layout.html
   branches/0.8/html/gadgets/Users/LayoutHTML.php
   branches/0.8/html/include/Jaws/Layout.php
Log:
use session data instead of user's table data

Modified: branches/0.8/html/gadgets/ControlPanel/templates/Layout.html
===================================================================
--- branches/0.8/html/gadgets/ControlPanel/templates/Layout.html	2012-01-23 08:03:47 UTC (rev 12479)
+++ branches/0.8/html/gadgets/ControlPanel/templates/Layout.html	2012-01-23 08:05:22 UTC (rev 12480)
@@ -28,7 +28,7 @@
    </div>
    <div id="login-info">
       <!-- BEGIN login-info -->
-      <img alt="{name}" width="48" height="48" src="{user_image}" />
+      <img alt="{name}" width="48" height="48" src="{avatar}" />
       <div class="name"><a href="{my-account-url}"><strong>{nickname}</strong></a></div>
       <div class="logout"><a href="{logout-url}">{logout}</a></div>
       <!-- END login-info -->

Modified: branches/0.8/html/gadgets/Users/LayoutHTML.php
===================================================================
--- branches/0.8/html/gadgets/Users/LayoutHTML.php	2012-01-23 08:03:47 UTC (rev 12479)
+++ branches/0.8/html/gadgets/Users/LayoutHTML.php	2012-01-23 08:05:22 UTC (rev 12480)
@@ -52,46 +52,41 @@
         } else {
             $tpl->SetBlock('UserBox');
             $tpl->SetVariable('title', _t('GLOBAL_MY_ACCOUNT'));
+            $uInfo = $GLOBALS['app']->Session->GetAttributes('username', 'nickname', 'avatar', 'email');
+            $tpl->SetVariable('user_name',  $uInfo['username']);
+            $tpl->SetVariable('user_title', $uInfo['nickname']);
+            $tpl->SetVariable('user_email', $uInfo['email']);
+            if ($GLOBALS['app']->Session->GetPermission('Users', 'EditAccountInformation')) {
+                $tpl->SetBlock('UserBox/account');
+                $tpl->SetVariable('user_account', _t('USERS_EDIT_ACCOUNT'));
+                $tpl->SetVariable('account_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Account'));
+                $tpl->ParseBlock('UserBox/account');
+            }
 
-            require_once JAWS_PATH . 'include/Jaws/User.php';
-            $uModel = new Jaws_User;
-            $uInfo = $uModel->GetUserInfoById($GLOBALS['app']->Session->GetAttribute('user'));
-            if ($uInfo !== false) {
-                $tpl->SetVariable('user_name',  $uInfo['username']);
-                $tpl->SetVariable('user_title', $uInfo['nickname']);
-                $tpl->SetVariable('user_email', $uInfo['email']);
-                if ($GLOBALS['app']->Session->GetPermission('Users', 'EditAccountInformation')) {
-                    $tpl->SetBlock('UserBox/account');
-                    $tpl->SetVariable('user_account', _t('USERS_EDIT_ACCOUNT'));
-                    $tpl->SetVariable('account_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Account'));
-                    $tpl->ParseBlock('UserBox/account');
-                }
+            if ($GLOBALS['app']->Session->GetPermission('Users', 'EditAccountProfile')) {
+                $tpl->SetBlock('UserBox/profile');
+                $tpl->SetVariable('user_profile', _t('USERS_EDIT_PROFILE'));
+                $tpl->SetVariable('profile_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Profile'));
+                $tpl->ParseBlock('UserBox/profile');
+            }
 
-                if ($GLOBALS['app']->Session->GetPermission('Users', 'EditAccountProfile')) {
-                    $tpl->SetBlock('UserBox/profile');
-                    $tpl->SetVariable('user_profile', _t('USERS_EDIT_PROFILE'));
-                    $tpl->SetVariable('profile_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Profile'));
-                    $tpl->ParseBlock('UserBox/profile');
-                }
+            if ($GLOBALS['app']->Session->GetPermission('Users', 'EditAccountPreferences')) {
+                $tpl->SetBlock('UserBox/preferences');
+                $tpl->SetVariable('user_Preferences', _t('USERS_EDIT_PREFERENCES'));
+                $tpl->SetVariable('Preferences_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Preferences'));
+                $tpl->ParseBlock('UserBox/preferences');
+            }
 
-                if ($GLOBALS['app']->Session->GetPermission('Users', 'EditAccountPreferences')) {
-                    $tpl->SetBlock('UserBox/preferences');
-                    $tpl->SetVariable('user_Preferences', _t('USERS_EDIT_PREFERENCES'));
-                    $tpl->SetVariable('Preferences_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Preferences'));
-                    $tpl->ParseBlock('UserBox/preferences');
-                }
-
-                if ($GLOBALS['app']->Session->GetPermission('ControlPanel', 'default_admin')) {
-                    $tpl->SetBlock('UserBox/cpanel');
-                    $tpl->SetVariable('cpanel', _t('USERS_CONTROLPANEL'));
-                    $admin_script = $GLOBALS['app']->Registry->Get('/config/admin_script');
-                    $tpl->SetVariable('cpanel_url', empty($admin_script)? 'admin.php' : $admin_script);
-                    $tpl->ParseBlock('UserBox/cpanel');
-                }
-
-                $tpl->SetVariable('logout', _t('GLOBAL_LOGOUT'));
-                $tpl->SetVariable('logout_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Logout'));
+            if ($GLOBALS['app']->Session->GetPermission('ControlPanel', 'default_admin')) {
+                $tpl->SetBlock('UserBox/cpanel');
+                $tpl->SetVariable('cpanel', _t('USERS_CONTROLPANEL'));
+                $admin_script = $GLOBALS['app']->Registry->Get('/config/admin_script');
+                $tpl->SetVariable('cpanel_url', empty($admin_script)? 'admin.php' : $admin_script);
+                $tpl->ParseBlock('UserBox/cpanel');
             }
+
+            $tpl->SetVariable('logout', _t('GLOBAL_LOGOUT'));
+            $tpl->SetVariable('logout_url', $GLOBALS['app']->Map->GetURLFor('Users', 'Logout'));
             $tpl->ParseBlock('UserBox');
         }
 

Modified: branches/0.8/html/include/Jaws/Layout.php
===================================================================
--- branches/0.8/html/include/Jaws/Layout.php	2012-01-23 08:03:47 UTC (rev 12479)
+++ branches/0.8/html/include/Jaws/Layout.php	2012-01-23 08:05:22 UTC (rev 12480)
@@ -310,13 +310,11 @@
     {
         $this->_Template->SetBlock('layout/login-info', false);
         $this->_Template->SetVariable('logged-in-as', _t('CONTROLPANEL_LOGGED_IN_AS'));
-        $this->_Template->SetVariable('username', $GLOBALS['app']->Session->GetAttribute('username'));
-        require_once JAWS_PATH . 'include/Jaws/User.php';
-        $userModel = new Jaws_User;
-        $userInfo = $userModel->GetUserInfoByName($GLOBALS['app']->Session->GetAttribute('username'));
-        $this->_Template->SetVariable('nickname', $userInfo['nickname']);
-        $this->_Template->SetVariable('email', $userInfo['email']);
-        $this->_Template->SetVariable('user_image', $userModel->GetAvatar($userInfo['username'], $userInfo['email']));
+        $uInfo = $GLOBALS['app']->Session->GetAttributes('username', 'nickname', 'avatar', 'email');
+        $this->_Template->SetVariable('username', $uInfo['username']);
+        $this->_Template->SetVariable('nickname', $uInfo['nickname']);
+        $this->_Template->SetVariable('email',    $uInfo['email']);
+        $this->_Template->SetVariable('avatar',   $uInfo['avatar']);
         $this->_Template->SetVariable('site-url', $GLOBALS['app']->GetSiteURL());
         $this->_Template->SetVariable('my-account', _t('GLOBAL_MY_ACCOUNT'));
         $this->_Template->SetVariable('my-account-url', BASE_SCRIPT . '?gadget=Users&action=MyAccount');



More information about the Jaws-commits mailing list