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

#2434 need able to hide extended options in visibility

RomanL 6 лет назад
Родитель
Сommit
31b31ec790

+ 11 - 1
inc/classes/BxDolPrivacy.php

@@ -338,7 +338,11 @@ class BxDolPrivacy extends BxDolFactory implements iBxDolFactoryObject
 
     public function addAclGroups($aValues, $iOwnerId, $aParams)
     {
-        $aLevels = BxDolAcl::getInstance()->getMemberships(false, true, true, true);
+		$aCheck = checkActionModule($iOwnerId, 'show membership levels in privacy groups', 'system', false);
+		if($aCheck[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED)
+			return $aValues;
+        
+		$aLevels = BxDolAcl::getInstance()->getMemberships(false, true, true, true);
         if(empty($aLevels) || !is_array($aLevels))
             return $aValues;
 
@@ -362,6 +366,9 @@ class BxDolPrivacy extends BxDolFactory implements iBxDolFactoryObject
             return $aValues;
 
         $bProfileProcessed = true; // don't allow to post to profiles for now
+        
+        $aExcludeModules = explode(',', getParam('sys_hide_post_to_context_for_privacy'));
+        
         foreach ($aModules as $aModule) {
             if (!$aModule['enabled'])
                 continue;
@@ -371,6 +378,9 @@ class BxDolPrivacy extends BxDolFactory implements iBxDolFactoryObject
 
             if (!BxDolRequest::serviceExists($aModule['name'], 'act_as_profile'))
                 continue;
+            
+            if (in_array($aModule['name'], $aExcludeModules))
+                continue;
 
             $bActAsProfile = BxDolService::call($aModule['name'], 'act_as_profile');
             if ($bActAsProfile && $bProfileProcessed)

+ 11 - 3
install/sql/system.sql

@@ -315,7 +315,7 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, 'sys_editor_default', '_adm_stg_cpt_option_sys_editor_default', 'sys_tinymce', 'digit', '', '', '', 50),
 (@iCategoryId, 'sys_captcha_default', '_adm_stg_cpt_option_sys_captcha_default', 'sys_recaptcha_new', 'digit', '', '', '', 51),
 (@iCategoryId, 'sys_player_default', '_adm_stg_cpt_option_sys_player_default', 'sys_html5', 'digit', '', '', '', 55),
-(@iCategoryId, 'sys_player_default_format', '_adm_stg_cpt_option_sys_player_default_quality', 'sd', 'select', 'sd,hd', '', '', 56),
+(@iCategoryId, 'sys_player_default_format', '_adm_stg_cpt_option_sys_player_default_format', 'sd', 'select', 'sd,hd', '', '', 56),
 
 (@iCategoryId, 'sys_live_updates_interval', '_adm_stg_cpt_option_sys_live_updates_interval', '10000', 'digit', '', '', '', 60),
 
@@ -489,8 +489,9 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, 'sys_metatags_hashtags_max', '_adm_stg_cpt_option_sys_metatags_hashtags_max', '9', 'digit', '', '', '', 30),
 (@iCategoryId, 'sys_metatags_mentions_max', '_adm_stg_cpt_option_sys_metatags_mentions_max', '9', 'digit', '', '', '', 31),
 
-(@iCategoryId, 'sys_profile_bot', '_adm_stg_cpt_option_sys_profile_bot', '', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:23:"get_options_profile_bot";s:5:"class";s:13:"TemplServices";}', '', '', 40);
+(@iCategoryId, 'sys_profile_bot', '_adm_stg_cpt_option_sys_profile_bot', '', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:23:"get_options_profile_bot";s:5:"class";s:13:"TemplServices";}', '', '', 40),
 
+(@iCategoryId, 'sys_hide_post_to_context_for_privacy', '_adm_stg_cpt_option_sys_hide_post_to_context_for_privacy', '', 'list', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:44:"get_options_module_list_for_privacy_selector";s:5:"class";s:13:"TemplServices";}', '', '', 50);
 --
 -- CATEGORY: Storage
 --
@@ -770,6 +771,10 @@ INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`,
 ('system', 'switch to any profile', NULL, '_sys_acl_action_switch_to_any_profile', '_sys_acl_action_switch_to_any_profile', 0, 0);
 SET @iIdActionSwitchToAnyProfile = LAST_INSERT_ID();
 
+INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
+('system', 'show membership levels in privacy groups', NULL, '_sys_acl_action_show_membership_levels_in_privacy_groups', '_sys_acl_action_show_membership_levels_in_privacy_groups_desc', 0, 0);
+SET @iIdActionShowMembershipLevelsInPrivacyGroups = LAST_INSERT_ID();
+
 CREATE TABLE `sys_acl_actions_track` (
   `IDAction` int(10) unsigned NOT NULL DEFAULT '0',
   `IDMember` int(10) unsigned NOT NULL default '0',
@@ -932,7 +937,10 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 (@iAdministrator, @iIdActionUseMacros),
 
 -- switch to any profile
-(@iAdministrator, @iIdActionSwitchToAnyProfile);
+(@iAdministrator, @iIdActionSwitchToAnyProfile),
+
+-- show membership levels in privacy groups
+(@iAdministrator, @iIdActionShowMembershipLevelsInPrivacyGroups);
 
 
 CREATE TABLE `sys_acl_levels` (

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

@@ -1462,6 +1462,7 @@
     <string name="_adm_stg_cpt_option_sys_tinymce_toolbar_full"><![CDATA[TinyMCE buttons for full editor]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_hashtags_max"><![CDATA[Max number of hashtags per post]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_mentions_max"><![CDATA[Max number of mentions per post]]></string>
+	<string name="_adm_stg_cpt_option_sys_hide_post_to_context_for_privacy"><![CDATA[Hide post to context for modules in Privacy field]]></string>
     <string name="_adm_stg_cpt_option_sys_search_keyword_min_len"><![CDATA[Keyword min length in site search]]></string>
     <string name="_adm_stg_cpt_option_sys_profile_bot"><![CDATA[System bot profile]]></string>
 	<string name="_adm_stg_cpt_type_system"><![CDATA[System]]></string>
@@ -1746,6 +1747,8 @@
 	<string name="_sys_acl_action_post_links_desc"><![CDATA[Post links in text and textarea form fields]]></string>    
 	<string name="_sys_acl_action_set_acl_level"><![CDATA[Set membership level]]></string>
 	<string name="_sys_acl_action_set_acl_level_desc"><![CDATA[Set membership level for profiles]]></string>
+  <string name="_sys_acl_action_show_membership_levels_in_privacy_groups"><![CDATA[Show membership levels in privacy groups]]></string>
+  <string name="_sys_acl_action_show_membership_levels_in_privacy_groups_desc"><![CDATA[Show membership levels in privacy groups]]></string>
   <string name="_sys_acl_action_set_badge"><![CDATA[Set badge]]></string>
   <string name="_sys_acl_action_set_badge_desc"><![CDATA[Set badge for content]]></string>
   <string name="_sys_acl_action_switch_to_any_profile"><![CDATA[Switch to any profile]]></string>

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

@@ -1735,6 +1735,8 @@
     <string name="_sys_acl_action_use_macros_desc"><![CDATA[Использовать специально сконструированный вызов, для вставки динамического контента практически в любой текст]]></string>
 	<string name="_sys_acl_action_set_acl_level"><![CDATA[Назначить членство]]></string>
 	<string name="_sys_acl_action_set_acl_level_desc"><![CDATA[Назначить членство для профилей]]></string>
+  <string name="_sys_acl_action_show_membership_levels_in_privacy_groups"><![CDATA[Показывать членство в группах конфиденциальности]]></string>
+  <string name="_sys_acl_action_show_membership_levels_in_privacy_groups_desc"><![CDATA[Показывать членство в группах конфиденциальности]]></string>
   <string name="_sys_acl_action_set_badge"><![CDATA[Назначение бейджей]]></string>
   <string name="_sys_acl_action_set_badge_desc"><![CDATA[Назначение бейджей для контента]]></string>
   <string name="_sys_acl_action_switch_to_any_profile"><![CDATA[Switch to any profile]]></string>

+ 17 - 0
template/scripts/BxBaseServices.php

@@ -363,6 +363,23 @@ class BxBaseServices extends BxDol implements iBxDolProfileService
 
         return $aResult;
     }
+    
+    public function serviceGetOptionsModuleListForPrivacySelector()
+    {
+        $aResult = array();
+        $BxDolModuleQuery = BxDolModuleQuery::getInstance();
+        $aModules = $BxDolModuleQuery->getModulesBy(array('type' => 'modules', 'active' => 1));
+        foreach($aModules as $aModule){
+            $oModule = BxDolModule::getInstance($aModule['name']);
+            if($oModule instanceof iBxDolContentInfoService){
+                if (!BxDolRequest::serviceExists($aModule['name'], 'act_as_profile'))
+                    continue;
+                $aResult[$aModule['name']] = $aModule['title'];
+            }
+        }
+        return $aResult;
+    }
+    
 
     public function serviceGetOptionsEmbedDefault()
     {