Skip to content

Commit

Permalink
Ticket #3636 - Ability to select multiple membership levels for priva…
Browse files Browse the repository at this point in the history
…cy field.
  • Loading branch information
AntonLV committed Jan 6, 2022
1 parent 217e537 commit 349cf88
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 20 deletions.
17 changes: 12 additions & 5 deletions inc/classes/BxDolPrivacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
define('BX_DOL_PG_FRIENDS_SELECTED', '6');
define('BX_DOL_PG_RELATIONS', '7');
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);

Expand Down Expand Up @@ -87,10 +88,16 @@ protected function __construct($aObject)
$this->_oDb = new BxDolPrivacyQuery();
$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();

Expand Down
6 changes: 5 additions & 1 deletion inc/js/classes/BxDolPrivacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ BxDolPrivacy.prototype.selectGroup = function(oElement)
if(!this._aGroupSettings[iGroupId])
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)
Expand Down
3 changes: 2 additions & 1 deletion install/sql/system.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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),
('7', '_sys_ps_group_title_relations', '@relations', 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` (
`id` int(11) unsigned NOT NULL auto_increment,
Expand Down
27 changes: 14 additions & 13 deletions modules/boonex/english/data/langs/system/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>{1}</b> deleted</li>
</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_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>
Expand Down
1 change: 1 addition & 0 deletions modules/boonex/russian/data/langs/system/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3191,6 +3191,7 @@
<li><b>{0}</b> всего</li>
<li><b>{1}</b> удалено</li>
</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_followers"><![CDATA[Подписчики]]></string>
<string name="_sys_ps_group_title_friends"><![CDATA[Друзья]]></string>
Expand Down

0 comments on commit 349cf88

Please sign in to comment.