Przeglądaj źródła

Ticket #3636 - Ability to select multiple membership levels for privacy field.

AntonLV 4 lat temu
rodzic
commit
349cf8856c

+ 12 - 5
inc/classes/BxDolPrivacy.php

@@ -15,7 +15,8 @@ define('BX_DOL_PG_FRIENDS', '5');
 define('BX_DOL_PG_FRIENDS_SELECTED', '6');
 define('BX_DOL_PG_FRIENDS_SELECTED', '6');
 define('BX_DOL_PG_RELATIONS', '7');
 define('BX_DOL_PG_RELATIONS', '7');
 define('BX_DOL_PG_RELATIONS_SELECTED', '8');
 define('BX_DOL_PG_RELATIONS_SELECTED', '8');
-define('BX_DOL_PG_CUSTOM', '9');
+define('BX_DOL_PG_ACL', '9');
+define('BX_DOL_PG_CUSTOM', '99');
 
 
 define('BX_DOL_PG_DEFAULT', BX_DOL_PG_ALL);
 define('BX_DOL_PG_DEFAULT', BX_DOL_PG_ALL);
 
 
@@ -87,10 +88,16 @@ class BxDolPrivacy extends BxDolFactory implements iBxDolFactoryObject
         $this->_oDb = new BxDolPrivacyQuery();
         $this->_oDb = new BxDolPrivacyQuery();
         $this->_oDb->init($this->_aObject);
         $this->_oDb->init($this->_aObject);
 
 
-        $this->_aGroupsSettings = array(
-            BX_DOL_PG_FRIENDS_SELECTED => array('connection' => 'sys_profiles_friends'),
-            BX_DOL_PG_RELATIONS_SELECTED => array('connection' => 'sys_profiles_relations')
-        );
+        $this->_aGroupsSettings = [
+            BX_DOL_PG_FRIENDS_SELECTED => [
+                'connection' => 'sys_profiles_friends', 
+                'js_method_create_group' => 'selectUsers'
+            ],
+            BX_DOL_PG_RELATIONS_SELECTED => [
+                'connection' => 'sys_profiles_relations', 
+                'js_method_create_group' => 'selectUsers'
+            ]
+        ];
 
 
         $this->_aGroupsExclude = array();
         $this->_aGroupsExclude = array();
 
 

+ 5 - 1
inc/js/classes/BxDolPrivacy.js

@@ -84,7 +84,11 @@ BxDolPrivacy.prototype.selectGroup = function(oElement)
     if(!this._aGroupSettings[iGroupId])
     if(!this._aGroupSettings[iGroupId])
         return;
         return;
 
 
-    this.selectUsers(oElement, iGroupId);
+    var sMethodCreateGroup = 'selectUsers';
+    if(this._aGroupSettings[iGroupId]['js_method_create_group'])
+        sMethodCreateGroup = this._aGroupSettings[iGroupId]['js_method_create_group'];
+
+    this[sMethodCreateGroup](oElement, iGroupId);
 };
 };
 
 
 BxDolPrivacy.prototype.onSelectGroup = function(oData)
 BxDolPrivacy.prototype.onSelectGroup = function(oData)

+ 2 - 1
install/sql/system.sql

@@ -2093,7 +2093,8 @@ INSERT INTO `sys_privacy_groups`(`id`, `title`, `check`, `active`, `visible`) VA
 ('6', '_sys_ps_group_title_friends_selected', '@friends_selected_by_object', 1, 1),
 ('6', '_sys_ps_group_title_friends_selected', '@friends_selected_by_object', 1, 1),
 ('7', '_sys_ps_group_title_relations', '@relations', 1, 1),
 ('7', '_sys_ps_group_title_relations', '@relations', 1, 1),
 ('8', '_sys_ps_group_title_relations_selected', '@relations_selected_by_object', 1, 1),
 ('8', '_sys_ps_group_title_relations_selected', '@relations_selected_by_object', 1, 1),
-('9', '_sys_ps_group_title_custom', '@custom_by_object', 0, 0);
+('9', '_sys_ps_group_title_acl_selected', '@acl_selected_by_object', 1, 1),
+('99', '_sys_ps_group_title_custom', '@custom_by_object', 0, 0);
 
 
 CREATE TABLE `sys_privacy_groups_custom` (
 CREATE TABLE `sys_privacy_groups_custom` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `id` int(11) unsigned NOT NULL auto_increment,

+ 14 - 13
modules/boonex/english/data/langs/system/en.xml

@@ -3226,19 +3226,20 @@ If it is not enabled then please consider implement this optimization, since it
             <li><b>{0}</b> total</li>
             <li><b>{0}</b> total</li>
             <li><b>{1}</b> deleted</li>
             <li><b>{1}</b> deleted</li>
         </ul>]]></string>
         </ul>]]></string>
-        <string name="_sys_ps_group_title_custom"><![CDATA[Custom]]></string>
-        <string name="_sys_ps_group_title_followers"><![CDATA[Followers]]></string>
-	<string name="_sys_ps_group_title_friends"><![CDATA[Friends]]></string>
-        <string name="_sys_ps_group_title_friends_selected"><![CDATA[Selected Friends...]]></string>
-        <string name="_sys_ps_group_title_relations"><![CDATA[Relationships]]></string>
-        <string name="_sys_ps_group_title_relations_selected"><![CDATA[Selected Relationships...]]></string>
-	<string name="_sys_ps_group_title_me_only"><![CDATA[Me only]]></string>
-	<string name="_sys_ps_group_title_members"><![CDATA[Members]]></string>
-	<string name="_sys_ps_group_title_public"><![CDATA[Public]]></string>
-        <string name="_sys_ps_group_title_participants"><![CDATA[Participants]]></string>
-	<string name="_sys_ps_group_title_closed"><![CDATA[Closed]]></string>
-	<string name="_sys_ps_group_title_secret"><![CDATA[Secret]]></string>
-        <string name="_sys_ps_group_title_unknown"><![CDATA[Unknown]]></string>
+    <string name="_sys_ps_group_title_acl_selected"><![CDATA[Selected Membership Levels...]]></string>
+    <string name="_sys_ps_group_title_custom"><![CDATA[Custom]]></string>
+    <string name="_sys_ps_group_title_followers"><![CDATA[Followers]]></string>
+    <string name="_sys_ps_group_title_friends"><![CDATA[Friends]]></string>
+    <string name="_sys_ps_group_title_friends_selected"><![CDATA[Selected Friends...]]></string>
+    <string name="_sys_ps_group_title_relations"><![CDATA[Relationships]]></string>
+    <string name="_sys_ps_group_title_relations_selected"><![CDATA[Selected Relationships...]]></string>
+    <string name="_sys_ps_group_title_me_only"><![CDATA[Me only]]></string>
+    <string name="_sys_ps_group_title_members"><![CDATA[Members]]></string>
+    <string name="_sys_ps_group_title_public"><![CDATA[Public]]></string>
+    <string name="_sys_ps_group_title_participants"><![CDATA[Participants]]></string>
+    <string name="_sys_ps_group_title_closed"><![CDATA[Closed]]></string>
+    <string name="_sys_ps_group_title_secret"><![CDATA[Secret]]></string>
+    <string name="_sys_ps_group_title_unknown"><![CDATA[Unknown]]></string>
     <string name="_sys_ps_ferr_incorrect_gc_not_allowed"><![CDATA[Custom privacy groups aren't allowed.]]></string>
     <string name="_sys_ps_ferr_incorrect_gc_not_allowed"><![CDATA[Custom privacy groups aren't allowed.]]></string>
     <string name="_sys_ps_ferr_incorrect_gc_owner"><![CDATA[You are not an owner of the content.]]></string>
     <string name="_sys_ps_ferr_incorrect_gc_owner"><![CDATA[You are not an owner of the content.]]></string>
     <string name="_sys_ps_ferr_incorrect_select"><![CDATA[You need to select some value]]></string>
     <string name="_sys_ps_ferr_incorrect_select"><![CDATA[You need to select some value]]></string>

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

@@ -3191,6 +3191,7 @@
             <li><b>{0}</b> всего</li>
             <li><b>{0}</b> всего</li>
             <li><b>{1}</b> удалено</li>
             <li><b>{1}</b> удалено</li>
         </ul>]]></string>
         </ul>]]></string>
+    <string name="_sys_ps_group_title_acl_selected"><![CDATA[Избранные уровни членства...]]></string>
     <string name="_sys_ps_group_title_custom"><![CDATA[Индивидуально]]></string>
     <string name="_sys_ps_group_title_custom"><![CDATA[Индивидуально]]></string>
     <string name="_sys_ps_group_title_followers"><![CDATA[Подписчики]]></string>
     <string name="_sys_ps_group_title_followers"><![CDATA[Подписчики]]></string>
     <string name="_sys_ps_group_title_friends"><![CDATA[Друзья]]></string>
     <string name="_sys_ps_group_title_friends"><![CDATA[Друзья]]></string>