Просмотр исходного кода

#703 redirect back to original page after switching context, minor redesign

Alex Trofimov 9 лет назад
Родитель
Сommit
9388067831

+ 1 - 0
modules/boonex/english/data/langs/system/en.xml

@@ -2406,6 +2406,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_txt_splash_slide02_txt"><![CDATA["Pull up a chair. Take a taste.<br />Come join us. Life is so endlessly<br />delicious."]]></string>
 	<string name="_sys_txt_splash_slide03_txt"><![CDATA["The only way to have a friend is to be one."]]></string>
 	<string name="_sys_txt_splash_slide04_txt"><![CDATA[Already one of us?]]></string>
+	<string name="_sys_txt_switch_profile_context"><![CDATA[Switch]]></string>
 	<string name="_sys_txt_unsubscribe_email_settings_update_success"><![CDATA[Your email preferences has been successfully updated.]]></string>
 	<string name="_sys_txt_unsubscribe_error_occured"><![CDATA[Error occurred, please login to your account and update email references there or contact site administrator to unsubscribe you manually.]]></string>
 	<string name="_sys_txt_unsubscribe_info"><![CDATA[Update email preferences for <b>{0}</b>]]></string>

+ 2 - 1
modules/boonex/russian/data/langs/system/ru.xml

@@ -2403,7 +2403,8 @@
 	<string name="_sys_txt_splash_slide01_desc"><![CDATA[Истории, идеи, фотографии, видео, вопросы, шутки, обсуждения, что угодно.<br />Следите за интересными людьми и будьте интересными для других.]]></string>
 	<string name="_sys_txt_splash_slide02_txt"><![CDATA["Присядь на стул. Попробуй.<br />Зарегистрируйся. Жизнь такая<br />сладкая."]]></string>
 	<string name="_sys_txt_splash_slide03_txt"><![CDATA["Лучший способ завести друзей - быть кому-то другом."]]></string>
-	<string name="_sys_txt_splash_slide04_txt"><![CDATA[Уже один из нас?]]></string>
+    <string name="_sys_txt_splash_slide04_txt"><![CDATA[Уже один из нас?]]></string>
+    <string name="_sys_txt_switch_profile_context"><![CDATA[Переключиться]]></string>
 	<string name="_sys_txt_unsubscribe_email_settings_update_success"><![CDATA[Ваши имейл-установки были удачно обновлены.]]></string>
 	<string name="_sys_txt_unsubscribe_error_occured"><![CDATA[Произошла ошибка, Пожалуйста, зайдите в свой аккаунт и обновите имейл-установки там или свяжитесь с администратором сайта, чтобы он Вас отписал вручную.]]></string>
 	<string name="_sys_txt_unsubscribe_info"><![CDATA[Обновить имейл-установки для <b>{0}</b>]]></string>

+ 12 - 10
template/css/account.css

@@ -6,7 +6,8 @@
 
 /*-- My Prpfiles: Switch Profile --*/
 .sys-profile-switch-row {
-    margin-top:1px;
+    position:relative;
+    margin-top:1px;    
 }
 
 .bx-db-content .sys-profile-switch-row.bx-def-margin-leftright-neg {
@@ -14,19 +15,20 @@
     margin-right: 0px;	
 }
 
-.sys-profile-switch-row-control,
-.sys-profile-switch-row-unit {
-    display:inline-block;
-    vertical-align:middle;
+.sys-profile-switch-row-control {
+    position: absolute;
+    right: 0;
+    top: 0;
+    height: 100%;
 }
 
 .sys-profile-switch-row-unit .bx-def-unit {
     margin:0;
 }
 
-.sys-profile-switch-row-control .sys-icon {
-    display:inline-block;
-    width:2rem;
-    height:2rem;
-    font-size:2rem;
+.sys-profile-switch-row-control .bx-btn {
+    position: absolute;
+    right: 0;
+    top: 50%;
+    transform: translateY(-50%);
 }

+ 0 - 1
template/css/menu.css

@@ -474,7 +474,6 @@ ul.bx-menu-btns-hor li:last-child .bx-btn {
 }
 
 .bx-menu-search-popup-title,
-.bx-menu-account-popup-profile,
 .bx-menu-account-popup-menu {
     text-align:center;
 }

+ 3 - 6
template/profile_switch_row.html

@@ -1,15 +1,12 @@
 <bx_repeat:row>
 
 <div class="sys-profile-switch-row bx-def-margin-leftright-neg bx-def-padding-leftright bx-def-padding-sec-topbottom __class__">
+    <div class="sys-profile-switch-row-unit bx-clearfix">__unit__</div>
     <div class="sys-profile-switch-row-control bx-def-margin-right">
-        <bx_if:active>
-            <i class="sys-icon check-square-o"></i>
-        </bx_if:active>
         <bx_if:inactive>
-            <a href="__url_switch__"><i class="sys-icon square-o"></i></a>
+            <a class="bx-btn bx-btn-small" href="__url_switch__"><bx_text:_sys_txt_switch_profile_context /></i></a>
         </bx_if:inactive>
-    </div>
-    <div class="sys-profile-switch-row-unit bx-clearfix">__unit__</div>
+    </div>    
 </div>
 
 </bx_repeat:row>

+ 6 - 1
template/scripts/BxBasePageAccount.php

@@ -61,8 +61,13 @@ class BxBasePageAccount extends BxTemplPage
             if (BxDolService::call($aProfile['type'], 'act_as_profile')) {
                 if ($oProfile && $oProfile->getAccountId() == getLoggedId()) {
                     $oAccount = BxDolAccount::getInstance();
-                    if ($oAccount->updateProfileContext($iSwitchToProfileId))
+                    if ($oAccount->updateProfileContext($iSwitchToProfileId)) {
                         $sInformerMsg = _t('_sys_txt_account_profile_context_changed_success', $oProfile->getDisplayName());
+                        if ((int)bx_get('redirect_back') && isset($_SERVER['HTTP_REFERER']) && 0 === mb_stripos($_SERVER['HTTP_REFERER'], BX_DOL_URL_ROOT)) {
+                            header("Location:" . $_SERVER['HTTP_REFERER']);
+                            exit;
+                        }
+                    }
                 }
 
                 if ($oInformer)

+ 2 - 2
template/scripts/BxBaseServiceProfiles.php

@@ -163,7 +163,7 @@ class BxBaseServiceProfiles extends BxDol
         return $s . '<div class="bx-clear"></div>';
     }
 
-    public function serviceAccountProfileSwitcher ($iAccountId = false, $iActiveProfileId = null, $sUrlProfileAction = '')
+    public function serviceAccountProfileSwitcher ($iAccountId = false, $iActiveProfileId = null, $sUrlProfileAction = '', $bViewMode = 0)
     {
     	$oTemplate = BxDolTemplate::getInstance();
     	BxDolInformer::getInstance($oTemplate)->setEnabled(false);
@@ -196,7 +196,7 @@ class BxBaseServiceProfiles extends BxDol
                 ),
                 'bx_if:inactive' => array (
                     'condition' => $iActiveProfileId != $aProfile['id'],
-                    'content' => array('id' => $aProfile['id'], 'url_switch' => $sUrlProfileAction ? str_replace('{profile_id}', $aProfile['id'], $sUrlProfileAction) : BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher', array('switch_to_profile' => $aProfile['id']))),
+                    'content' => array('id' => $aProfile['id'], 'url_switch' => $sUrlProfileAction ? str_replace('{profile_id}', $aProfile['id'], $sUrlProfileAction) : BxDolPermalinks::getInstance()->permalink('page.php?i=account-profile-switcher', array('switch_to_profile' => $aProfile['id'], 'redirect_back' => 1))),
                 ),
                 'unit' => BxDolService::call($aProfile['type'], 'profile_unit', array($aProfile['content_id'])),
             );