AntonLV 9 năm trước cách đây
mục cha
commit
dc84679ac1

+ 3 - 1
install/sql/system.sql

@@ -416,7 +416,8 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, 'sys_account_online_time', '_adm_stg_cpt_option_sys_account_online_time', '5', 'digit', '', 'Avail', '_adm_stg_err_option_sys_account_online_time', 1),
 (@iCategoryId, 'sys_account_autoapproval', '_adm_stg_cpt_option_sys_account_autoapproval', 'on', 'checkbox', '', '', '', 10),
 (@iCategoryId, 'sys_account_activation_letter', '_adm_stg_cpt_option_sys_account_activation_letter', '', 'checkbox', '', '', '', 11),
-(@iCategoryId, 'sys_account_limit_profiles_number', '_adm_stg_cpt_option_sys_account_limit_profiles_number', '0', 'digit', '', '', '', 20);
+(@iCategoryId, 'sys_account_default_profile_type', '_adm_stg_cpt_option_sys_account_default_profile_type', '', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:17:"get_profile_types";s:5:"class";s:20:"TemplServiceProfiles";}', '', '', 20),
+(@iCategoryId, 'sys_account_limit_profiles_number', '_adm_stg_cpt_option_sys_account_limit_profiles_number', '0', 'digit', '', '', '', 21);
 
 --
 -- CATEGORY: ACL
@@ -3097,6 +3098,7 @@ INSERT INTO `sys_objects_menu` (`object`, `title`, `set_name`, `module`, `templa
 ('sys_account', '_sys_menu_title_account', 'sys_account_links', 'system', 7, 0, 1, 'BxTemplMenuAccount', ''),
 ('sys_add_content', '_sys_menu_title_add_content', 'sys_add_content_links', 'system', 14, 0, 1, 'BxTemplMenuSite', ''),
 ('sys_add_profile', '_sys_menu_title_add_profile', 'sys_add_profile_links', 'system', 14, 0, 1, 'BxTemplMenuProfileAdd', ''),
+('sys_add_profile_vertical', '_sys_menu_title_add_profile_vertical', 'sys_add_profile_links', 'system', 6, 0, 1, 'BxTemplMenuProfileAdd', ''),
 ('sys_account_dashboard_manage_tools', '_sys_menu_title_account_dashboard_manage_tools', 'sys_account_dashboard_manage_tools', 'system', 4, 0, 1, '', ''),
 ('sys_account_settings_submenu', '_sys_menu_title_account_settings', 'sys_account_settings', 'system', 8, 0, 1, '', ''),
 ('sys_account_settings_more', '_sys_menu_title_account_settings_more', 'sys_account_settings_more', 'system', 4, 0, 1, '', ''),

+ 21 - 0
modules/base/profile/classes/BxBaseModProfileInstaller.php

@@ -11,14 +11,35 @@
 
 class BxBaseModProfileInstaller extends BxBaseModGeneralInstaller
 {
+    protected $_sParamDefaultProfileType;
+
     function __construct($aConfig)
     {
         parent::__construct($aConfig);
+
+        $this->_sParamDefaultProfileType = 'sys_account_default_profile_type';
+    }
+
+    function enable($aParams)
+    {
+        $aResult = parent::enable($aParams);
+        if(BxDolService::call($this->_aConfig['name'], 'act_as_profile') !== true)
+            return $aResult;
+
+        if($aResult['result'] && getParam($this->_sParamDefaultProfileType) == '')
+        	setParam($this->_sParamDefaultProfileType, $this->_aConfig['name']);
+
+        return $aResult;
     }
 
     function disable($aParams)
     {
         $aResult = parent::disable($aParams);
+        if(BxDolService::call($this->_aConfig['name'], 'act_as_profile') !== true)
+            return $aResult;
+
+        if($aResult['result'] && getParam($this->_sParamDefaultProfileType) == $this->_aConfig['name'])
+        	setParam($this->_sParamDefaultProfileType, '');
 
         if ($aResult['result']) { // disabling was successful
             // TODO: switch accounts context which active profiles belong to this module

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

@@ -1217,6 +1217,7 @@
 	<string name="_adm_stg_cpt_option_sys_account_autoapproval"><![CDATA[Automatic account activation after creation]]></string>
 	<string name="_adm_stg_cpt_option_sys_account_online_time"><![CDATA[Online status timeframe (minutes)]]></string>
     <string name="_adm_stg_err_option_sys_account_online_time"><![CDATA[You need to enter a value greater than zero.]]></string>
+    <string name="_adm_stg_cpt_option_sys_account_default_profile_type"><![CDATA[Default profile type]]></string>
 	<string name="_adm_stg_cpt_option_sys_account_limit_profiles_number"><![CDATA[Limit number of profiles (0 - no limit)]]></string>
 	<string name="_adm_stg_cpt_option_sys_acl_expire_notification_days"><![CDATA[Number of days before membership expiration to notify members (-1 = after expiration)]]></string>
 	<string name="_adm_stg_cpt_option_sys_acl_expire_notify_once"><![CDATA[Notify members about membership expiration only once (every day otherwise)]]></string>
@@ -2089,6 +2090,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_menu_title_account_settings_more"><![CDATA[Account Settings More Menu]]></string>
 	<string name="_sys_menu_title_add_content"><![CDATA[Add Content Menu]]></string>
 	<string name="_sys_menu_title_add_profile"><![CDATA[Add Profile Menu]]></string>
+	<string name="_sys_menu_title_add_profile_vertical"><![CDATA[Add Profile Menu (vertical)]]></string>
 	<string name="_sys_menu_title_cmts_item_actions"><![CDATA[Comment Actions]]></string>
 	<string name="_sys_menu_title_cmts_item_manage"><![CDATA[Manage Comment]]></string>
 	<string name="_sys_menu_title_footer"><![CDATA[Footer Links]]></string>

+ 1 - 0
modules/boonex/organizations/install/langs/en.xml

@@ -84,6 +84,7 @@
 	<string name="_bx_orgs_page_title_online"><![CDATA[Online Organizations]]></string>
 
     <string name="_bx_orgs_page_block_title_profile_private"><![CDATA[Private Profile]]></string>
+    <string name="_bx_orgs_page_block_title_choose_type"><![CDATA[Choose Profile Type]]></string>
 	<string name="_bx_orgs_page_block_title_create_profile"><![CDATA[Create a Profile - Organization]]></string>
 	<string name="_bx_orgs_page_block_title_edit_profile"><![CDATA[Edit Profile]]></string>
 	<string name="_bx_orgs_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>

+ 3 - 2
modules/boonex/organizations/install/sql/enable.sql

@@ -27,8 +27,9 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `e
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_organizations_create_profile', 'create-organization-profile', '_bx_orgs_page_title_sys_create_profile', '_bx_orgs_page_title_create_profile', 'bx_organizations', 5, 2147483647, 1, 'page.php?i=create-organization-profile', '', '', '', 0, 1, 0, '', '');
 
-INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_organizations_create_profile', 1, 'bx_organizations', '_bx_orgs_page_block_title_create_profile', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:13:\"entity_create\";}', 0, 1, 1);
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES
+('bx_organizations_create_profile', 1, 'bx_organizations', '_bx_orgs_page_block_title_choose_type', 11, 2147483647, 'menu', 'sys_add_profile_vertical', 0, 1, 0, 0),
+('bx_organizations_create_profile', 1, 'bx_organizations', '_bx_orgs_page_block_title_create_profile', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:16:\"bx_organizations\";s:6:\"method\";s:13:\"entity_create\";}', 0, 1, 1, 1);
 
 -- PAGE: view profile
 

+ 1 - 0
modules/boonex/persons/install/langs/en.xml

@@ -82,6 +82,7 @@
 	<string name="_bx_persons_page_title_online"><![CDATA[Online People]]></string>
 
 	<string name="_bx_persons_page_block_title_profile_private"><![CDATA[Private Profile]]></string>
+	<string name="_bx_persons_page_block_title_choose_type"><![CDATA[Choose Profile Type]]></string>
 	<string name="_bx_persons_page_block_title_create_profile"><![CDATA[Create a Profile - Person]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile"><![CDATA[Edit Profile]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile_cover"><![CDATA[Edit Cover]]></string>

+ 3 - 2
modules/boonex/persons/install/sql/enable.sql

@@ -27,8 +27,9 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `e
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_persons_create_profile', 'create-persons-profile', '_bx_persons_page_title_sys_create_profile', '_bx_persons_page_title_create_profile', 'bx_persons', 5, 2147483647, 1, 'page.php?i=create-persons-profile', '', '', '', 0, 1, 0, '', '');
 
-INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
-('bx_persons_create_profile', 1, 'bx_persons', '_bx_persons_page_block_title_create_profile', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:13:\"entity_create\";}', 0, 1, 1);
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
+('bx_persons_create_profile', 1, 'bx_persons', '_bx_persons_page_block_title_choose_type', 11, 2147483647, 'menu', 'sys_add_profile_vertical', 0, 1, 0, 0),
+('bx_persons_create_profile', 1, 'bx_persons', '_bx_persons_page_block_title_create_profile', 11, 2147483647, 'service', 'a:2:{s:6:\"module\";s:10:\"bx_persons\";s:6:\"method\";s:13:\"entity_create\";}', 0, 1, 1, 1);
 
 -- PAGE: view profile
 INSERT INTO `sys_objects_page`(`object`, `uri`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES 

+ 1 - 0
modules/boonex/russian/data/langs/bx_organizations/ru.xml

@@ -84,6 +84,7 @@
 	<string name="_bx_orgs_page_title_online"><![CDATA[Онлайн Организации]]></string>
 
     <string name="_bx_orgs_page_block_title_profile_private"><![CDATA[Приватный профиль]]></string>
+    <string name="_bx_orgs_page_block_title_choose_type"><![CDATA[Выбрать тип профиля]]></string>
 	<string name="_bx_orgs_page_block_title_create_profile"><![CDATA[Создать профиль - организация]]></string>
 	<string name="_bx_orgs_page_block_title_edit_profile"><![CDATA[Редактировать профиль]]></string>
 	<string name="_bx_orgs_page_block_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/bx_persons/ru.xml

@@ -82,6 +82,7 @@
 	<string name="_bx_persons_page_title_online"><![CDATA[Онлайн Пользователи]]></string>
 
     <string name="_bx_persons_page_block_title_profile_private"><![CDATA[Приватный профиль]]></string>
+    <string name="_bx_persons_page_block_title_choose_type"><![CDATA[Выбрать тип профиля]]></string>
 	<string name="_bx_persons_page_block_title_create_profile"><![CDATA[Создать профиль - человек]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile"><![CDATA[Редактировать профиль]]></string>
 	<string name="_bx_persons_page_block_title_edit_profile_cover"><![CDATA[Редактировать обложку]]></string>

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

@@ -1215,6 +1215,7 @@
 	<string name="_adm_stg_cpt_option_sys_account_autoapproval"><![CDATA[Автоматическая активация аккаунта после создания]]></string>
 	<string name="_adm_stg_cpt_option_sys_account_online_time"><![CDATA[Временные рамки статуса "онлайн" (минуты)]]></string>
     <string name="_adm_stg_err_option_sys_account_online_time"><![CDATA[Вам необходимо ввести значение больше нуля.]]></string>
+    <string name="_adm_stg_cpt_option_sys_account_default_profile_type"><![CDATA[Тип профиля по умолчанию]]></string>
     <string name="_adm_stg_cpt_option_sys_account_limit_profiles_number"><![CDATA[Ограничить число профилей (0 - без ограничений)]]></string>
 	<string name="_adm_stg_cpt_option_sys_acl_expire_notification_days"><![CDATA[За сколько дней до окончания членства оповестить пользователя об окончании (-1 = после окончания)]]></string>
 	<string name="_adm_stg_cpt_option_sys_acl_expire_notify_once"><![CDATA[Оповещать пользователей об окончании членства только одинажды (каждый день в противном случае)]]></string>
@@ -2085,8 +2086,9 @@
     <string name="_sys_menu_title_account_popup"><![CDATA[Аккаунт - Всплывающее Меню]]></string>
 	<string name="_sys_menu_title_account_settings"><![CDATA[Аккаунт - Меню Настроек]]></string>
 	<string name="_sys_menu_title_account_settings_more"><![CDATA[Аккаунт - Меню Дополнительных Настроек]]></string>
-	<string name="_sys_menu_title_add_content"><![CDATA[Добавить Меню Содержимого]]></string>
-	<string name="_sys_menu_title_add_profile"><![CDATA[Добавить Меню Профиля]]></string>
+	<string name="_sys_menu_title_add_content"><![CDATA[Добавить содержимое - Меню]]></string>
+	<string name="_sys_menu_title_add_profile"><![CDATA[Добавить профиль - Меню]]></string>
+	<string name="_sys_menu_title_add_profile_vertical"><![CDATA[Добавить профиль - Меню вертикальное]]></string>
 	<string name="_sys_menu_title_cmts_item_actions"><![CDATA[Комментировать Действия]]></string>
 	<string name="_sys_menu_title_cmts_item_manage"><![CDATA[Управление Комментарием]]></string>
 	<string name="_sys_menu_title_footer"><![CDATA[Футер - Ссылки]]></string>

+ 1 - 1
template/css/account.css

@@ -1,6 +1,6 @@
 /*-- My Prpfiles: Create Profile --*/
 .bx-menu-object-sys_add_profile {
-	text-align: center;
+    text-align: center;
 }
 
 

+ 3 - 0
template/scripts/BxBaseAccountForms.php

@@ -92,8 +92,11 @@ class BxBaseAccountForms extends BxDolProfileForms
         }
 
         $sRedirectUrl = '';
+        $sDefaultProfileType = getParam('sys_account_default_profile_type');
         if(count($aModulesProfile) == 1)
         	$sRedirectUrl = BxDolService::call($aModulesProfile[0]['name'], 'profile_create_url', array(false));
+        else if(!empty($sDefaultProfileType)) 
+            $sRedirectUrl = BxDolService::call($sDefaultProfileType, 'profile_create_url', array(false));
 
         $this->_redirectAndExit(!empty($sRedirectUrl) ? $sRedirectUrl : getParam('sys_redirect_after_account_added'), true, array(
             'account_id' => $iAccountId,

+ 20 - 0
template/scripts/BxBaseServiceProfiles.php

@@ -17,6 +17,26 @@ class BxBaseServiceProfiles extends BxDol
         parent::__construct();
     }
 
+    public function serviceGetProfileTypes()
+    {
+        $aTypes = array(
+			'' => _t('_Select_one')
+        );
+
+        $aModules = $this->_getProfilesModules();
+        foreach($aModules as $aModule) {
+			if(empty($aModule) || !is_array($aModule))
+				continue;
+
+            $sTitleKey = '_' . $aModule['name'];
+            $sTitle = _t($sTitleKey);
+
+            $aTypes[$aModule['name']] = !empty($sTitle) && $sTitle != $sTitleKey ? $sTitle : $aModule['title'];
+		}
+
+        return $aTypes;
+    }
+
     public function serviceProfileStats ($iProfileId = 0)
     {
         if (!$iProfileId && !($iProfileId = bx_get_logged_profile_id()))