ソースを参照

#741 OAuth: enhancements in profile chooser

Alex Trofimov 9 年 前
親
コミット
237a27d050

+ 5 - 0
modules/base/profile/template/unit_wo_links.html

@@ -0,0 +1,5 @@
+
+<div class="bx-base-pofile-unit bx-def-unit bx-def-margin-bottom bx-def-margin-sec-right">
+    <img class="bx-def-thumb bx-def-thumb-size" src="__thumb_url__" /><div class="bx-def-unit-info bx-def-thumb-size-max-height bx-def-padding-sec-left"><span class="bx-def-unit-info-title">__title__</span></div>
+</div>
+

+ 1 - 1
modules/boonex/oauth2/classes/BxOAuthModule.php

@@ -193,7 +193,7 @@ class BxOAuthModule extends BxDolModule
             'redirect_uri' => bx_get('redirect_uri'),
         	'scope' => bx_get('scope'),
             'state' => bx_get('state'),
-            'profiles' => BxDolService::call('system', 'account_profile_switcher', array(getLoggedId(), false, "javascript: $('#bx-auth-profile-id').val('{profile_id}'); $('#bx-auth-form form').submit(); void(0);"), 'TemplServiceProfiles')['content'],
+            'profiles' => BxDolService::call('system', 'account_profile_switcher', array(getLoggedId(), false, "javascript: $('#bx-auth-profile-id').val('{profile_id}'); $('#bx-auth-form form').submit(); void(0);", true, _t('_bx_oauth_connect'), 'unit_wo_links'), 'TemplServiceProfiles')['content'],
         ));
     }
 

+ 2 - 1
modules/boonex/oauth2/install/langs/en.xml

@@ -14,9 +14,10 @@ Specify the following "Main UNA Site URL" on the client sites:<br />
 	<string name="_bx_oauth_add"><![CDATA[Add new client]]></string>
 	<string name="_bx_oauth_clients"><![CDATA[OAuth2 clients]]></string>
 	<string name="_bx_oauth_authorization"><![CDATA[Authorization]]></string>
-    <string name="_bx_oauth_authorize_app"><![CDATA[Choose profile to use on "{0}" site:]]></string>
+    <string name="_bx_oauth_authorize_app"><![CDATA[Choose which profile to connect with "{0}":]]></string>
     <string name="_bx_oauth_form_valid_url"><![CDATA[Valid URL is required]]></string>
     <string name="_bx_oauth_url"><![CDATA[URL]]></string>
+    <string name="_bx_oauth_connect"><![CDATA[Connect]]></string>
 
 	<string name="_bx_oauth_adm_stg_cpt_type"><![CDATA[OAuth2 Server]]></string>
 	<string name="_bx_oauth_adm_stg_cpt_category_general"><![CDATA[General]]></string>

+ 1 - 0
modules/boonex/organizations/template/unit_wo_links.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/unit_wo_links.html />

+ 1 - 0
modules/boonex/persons/template/unit_wo_links.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/profile/template/unit_wo_links.html />

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

@@ -14,9 +14,10 @@
 	<string name="_bx_oauth_add"><![CDATA[Добавить]]></string>
 	<string name="_bx_oauth_clients"><![CDATA[Клиенты OAuth2]]></string>
 	<string name="_bx_oauth_authorization"><![CDATA[Authorization]]></string>
-    <string name="_bx_oauth_authorize_app"><![CDATA[Выбери профайл, для использования на "{0}" сайте:]]></string>
+    <string name="_bx_oauth_authorize_app"><![CDATA[Выбери профайл, для использования на "{0}":]]></string>
     <string name="_bx_oauth_form_valid_url"><![CDATA[Нужно ввести правильный URL]]></string>
     <string name="_bx_oauth_url"><![CDATA[URL]]></string>
+    <string name="_bx_oauth_connect"><![CDATA[Связать]]></string>
 
 	<string name="_bx_oauth_adm_stg_cpt_type"><![CDATA[OAuth2 сервер]]></string>
 	<string name="_bx_oauth_adm_stg_cpt_category_general"><![CDATA[Общие]]></string>

+ 1 - 1
template/profile_switch_row.html

@@ -5,7 +5,7 @@
     <div class="sys-profile-switch-row-unit bx-clearfix">__unit__</div>
     <div class="sys-profile-switch-row-control bx-def-margin-right">
         <bx_if:inactive>
-            <a class="bx-btn bx-btn-small" href="__url_switch__"><bx_text:_sys_txt_switch_profile_context /></i></a>
+            <a class="bx-btn bx-btn-small" href="__url_switch__">__button_title__</i></a>
         </bx_if:inactive>
     </div>
 </div>

+ 7 - 3
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 = '', $bShowAll = 0)
+    public function serviceAccountProfileSwitcher ($iAccountId = false, $iActiveProfileId = null, $sUrlProfileAction = '', $bShowAll = 0, $sButtonTitle = '', $sProfileTemplate = '')
     {
     	$oTemplate = BxDolTemplate::getInstance();
     	BxDolInformer::getInstance($oTemplate)->setEnabled(false);
@@ -199,9 +199,13 @@ 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'], 'redirect_back' => 1))),
+                    'content' => array(
+                        'id' => $aProfile['id'], 
+                        'button_title' => $sButtonTitle ? $sButtonTitle : _t('_sys_txt_switch_profile_context'),
+                        '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'])),
+                'unit' => BxDolService::call($aProfile['type'], 'profile_unit', array($aProfile['content_id'], array('template' => $sProfileTemplate))),
             );
         }