Explorar o código

Ticket #1694 - Changes in Profile modules.

AntonLV %!s(int64=7) %!d(string=hai) anos
pai
achega
9c46995d90

+ 3 - 0
modules/boonex/organizations/classes/BxOrgsConfig.php

@@ -52,6 +52,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'FIELD_COVER' => 'cover',
             'FIELD_JOIN_CONFIRMATION' => 'join_confirmation',
             'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
+            'FIELD_ALLOW_POST_TO' => 'allow_post_to',
             'FIELD_VIEWS' => 'views',
             'FIELD_COMMENTS' => 'comments',
             'FIELDS_QUICK_SEARCH' => array('org_name'),
@@ -130,6 +131,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_organizations_view_profile_closed',
             'OBJECT_PRIVACY_VIEW' => 'bx_organizations_allow_view_to',
             'OBJECT_PRIVACY_VIEW_NOTIFICATION_EVENT' => 'bx_organizations_allow_view_notification_to',
+            'OBJECT_PRIVACY_POST' => 'bx_organizations_allow_post_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_organizations_administration',
             'OBJECT_GRID_COMMON' => 'bx_organizations_common',
             'OBJECT_GRID_CONNECTIONS' => 'bx_organizations_fans',
@@ -189,6 +191,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             	'txt_sample_pi_action' => '_bx_orgs_txt_sample_pi_action',
             	'txt_sample_pi_action_user' => '_bx_orgs_txt_sample_pi_action_user',
             	'txt_private_group' => '_bx_orgs_txt_private_organization',
+                'txt_group_participants' => '_bx_orgs_ps_group_title_participants',
                 'txt_N_fans' => '_bx_orgs_txt_N_friends',
             	'txt_ntfs_join_request' => '_bx_orgs_txt_ntfs_join_request',
                 'txt_ntfs_fan_added' => '_bx_orgs_txt_ntfs_fan_added',

+ 6 - 4
modules/boonex/organizations/classes/BxOrgsPrivacy.php

@@ -14,14 +14,16 @@ class BxOrgsPrivacy extends BxBaseModGroupsPrivacy
     function __construct($aOptions, $oTemplate = false)
     {
     	$this->MODULE = 'bx_organizations';
-    	$this->_aPrivacyParticallyVisible = array ('c', 5);
 
         parent::__construct($aOptions, $oTemplate);
+
+        $this->_aGroupsExclude = array();
+        $this->_aPrivacyParticallyVisible = array(BX_DOL_PG_FRIENDS, BX_BASE_MOD_GROUPS_PG_CLOSED);
     }
-    
-    protected function getGroups() 
+
+    protected function getObjectInfo($sAction, $iObjectId)
     {
-        return BxBaseModProfilePrivacy::getGroups();
+        return BxBaseModProfilePrivacy::getObjectInfo($sAction, $iObjectId);
     }
 }
 

+ 5 - 0
modules/boonex/organizations/classes/BxOrgsPrivacyNotifications.php

@@ -16,6 +16,11 @@ class BxOrgsPrivacyNotifications extends BxBaseModGroupsPrivacyNotifications
     	$this->MODULE = 'bx_organizations';
         parent::__construct($aOptions, $oTemplate);
     }
+
+    protected function getObjectInfo($sAction, $iObjectId)
+    {
+        return BxBaseModProfilePrivacy::getObjectInfo($sAction, $iObjectId);
+    }
 }
 
 /** @} */

+ 29 - 0
modules/boonex/organizations/classes/BxOrgsPrivacyPost.php

@@ -0,0 +1,29 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Organizations Organizations
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxOrgsPrivacyPost extends BxBaseModGroupsPrivacyPost
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+    	$this->_sModule = 'bx_organizations';
+
+        parent::__construct($aOptions, $oTemplate);
+
+        $this->_aGroupsExclude = array();
+    }
+
+    protected function getObjectInfo($sAction, $iObjectId)
+    {
+        return BxBaseModProfilePrivacyPost::getObjectInfo($sAction, $iObjectId);
+    }
+}
+
+/** @} */

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

@@ -34,6 +34,8 @@
     <string name="_bx_orgs_form_profile_input_allow_view_to"><![CDATA[Visible to]]></string>
     <string name="_bx_orgs_form_profile_input_allow_view_to_info"><![CDATA[Closed - anyone can find the organization and see who's in it, only members can see posts. Secret - only members can find the organization and see posts.]]></string>
     <string name="_bx_orgs_form_profile_input_allow_view_notification_to"><![CDATA[Show notifications to]]></string>
+    <string name="_bx_orgs_form_profile_input_sys_allow_post_to"><![CDATA[Who can post]]></string>
+    <string name="_bx_orgs_form_profile_input_allow_post_to"><![CDATA[Who can post]]></string>
     <string name="_bx_orgs_form_profile_input_sys_initial_members"><![CDATA[Invite Members]]></string>
     <string name="_bx_orgs_form_profile_input_initial_members"><![CDATA[Invite Members]]></string>
     <string name="_bx_orgs_form_profile_input_sys_org_name"><![CDATA[Organization Name]]></string>
@@ -385,6 +387,7 @@
     <string name="_bx_orgs_txt_to_admins"><![CDATA[To Admins]]></string>
     <string name="_bx_orgs_txt_from_admins"><![CDATA[From Admins]]></string>
     <string name="_bx_orgs_txt_private_organization"><![CDATA[Private organization]]></string>
+    <string name="_bx_orgs_ps_group_title_participants"><![CDATA[Employees]]></string>
 
     <string name="_bx_orgs_email_friend_request"><![CDATA[Friend request]]></string>
     <string name="_bx_orgs_email_friend_request_subject"><![CDATA[Friendship Request]]></string>

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

@@ -633,7 +633,8 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 -- PRIVACY 
 INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `spaces`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
 ('bx_organizations_allow_view_to', 'bx_organizations', 'view', '_bx_orgs_form_profile_input_allow_view_to', '3', '', 'bx_organizations_data', 'id', 'author', 'BxOrgsPrivacy', 'modules/boonex/organizations/classes/BxOrgsPrivacy.php'),
-('bx_organizations_allow_view_notification_to', 'bx_organizations', 'view_event', '_bx_orgs_form_profile_input_allow_view_notification_to', '3', '', 'bx_notifications_events', 'id', 'object_owner_id', 'BxOrgsPrivacyNotifications', 'modules/boonex/organizations/classes/BxOrgsPrivacyNotifications.php');
+('bx_organizations_allow_view_notification_to', 'bx_organizations', 'view_event', '_bx_orgs_form_profile_input_allow_view_notification_to', '3', '', 'bx_notifications_events', 'id', 'object_owner_id', 'BxOrgsPrivacyNotifications', 'modules/boonex/organizations/classes/BxOrgsPrivacyNotifications.php'),
+('bx_organizations_allow_post_to', 'bx_organizations', 'post', '_bx_orgs_form_profile_input_allow_post_to', '3', '', 'bx_organizations_data', 'id', 'author', 'BxOrgsPrivacyPost', 'modules/boonex/organizations/classes/BxOrgsPrivacyPost.php');
 
 
 -- EMAIL TEMPLATES

+ 6 - 2
modules/boonex/organizations/install/sql/install.sql

@@ -24,6 +24,7 @@ CREATE TABLE IF NOT EXISTS `bx_organizations_data` (
   `featured` int(11) NOT NULL default '0',
   `join_confirmation` tinyint(4) NOT NULL DEFAULT '1',
   `allow_view_to` varchar(16) NOT NULL DEFAULT '3',
+  `allow_post_to` varchar(16) NOT NULL DEFAULT '3',
   PRIMARY KEY (`id`),
   FULLTEXT KEY `search_fields` (`org_name`,`org_desc`)
 );
@@ -244,6 +245,7 @@ INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`,
 
 INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES 
 ('bx_organization', 'bx_organizations', 'allow_view_to', 3, '', 0, 'custom', '_bx_orgs_form_profile_input_sys_allow_view_to', '_bx_orgs_form_profile_input_allow_view_to', '_bx_orgs_form_profile_input_allow_view_to_info', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_organization', 'bx_organizations', 'allow_post_to', 3, '', 0, 'custom', '_bx_orgs_form_profile_input_sys_allow_post_to', '_bx_orgs_form_profile_input_allow_post_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_organization', 'bx_organizations', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_orgs_form_profile_input_sys_delete_confirm', '_bx_orgs_form_profile_input_delete_confirm', '_bx_orgs_form_profile_input_delete_confirm_info', 1, 0, 0, '', '', '', 'avail', '', '_bx_orgs_form_profile_input_delete_confirm_error', '', '', 1, 0),
 ('bx_organization', 'bx_organizations', 'do_submit', '_sys_form_account_input_submit', '', 0, 'submit', '_bx_orgs_form_profile_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_organization', 'bx_organizations', 'org_desc', '', '', 0, 'textarea', '_bx_orgs_form_profile_input_sys_org_desc', '_bx_orgs_form_profile_input_org_desc', '', 0, 0, 1, '', '', '', '', '', '', 'XssHtml', '', 1, 1),
@@ -270,7 +272,8 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_organization_add', 'location', 2147483647, 1, 6),
 ('bx_organization_add', 'join_confirmation', 2147483647, 1, 7),
 ('bx_organization_add', 'allow_view_to', 2147483647, 1, 8),
-('bx_organization_add', 'do_submit', 2147483647, 1, 9),
+('bx_organization_add', 'allow_post_to', 2147483647, 1, 9),
+('bx_organization_add', 'do_submit', 2147483647, 1, 10),
 
 ('bx_organization_invite', 'initial_members', 2147483647, 1, 1),
 ('bx_organization_invite', 'do_submit', 2147483647, 1, 2),
@@ -285,7 +288,8 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_organization_edit', 'location', 2147483647, 1, 5),
 ('bx_organization_edit', 'join_confirmation', 2147483647, 1, 6),
 ('bx_organization_edit', 'allow_view_to', 2147483647, 1, 7),
-('bx_organization_edit', 'do_submit', 2147483647, 1, 8),
+('bx_organization_edit', 'allow_post_to', 2147483647, 1, 8),
+('bx_organization_edit', 'do_submit', 2147483647, 1, 9),
 
 ('bx_organization_edit_cover', 'cover', 2147483647, 1, 1),
 ('bx_organization_edit_cover', 'do_submit', 2147483647, 1, 2),

+ 2 - 0
modules/boonex/persons/classes/BxPersonsConfig.php

@@ -47,6 +47,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'FIELD_PICTURE' => 'picture',
             'FIELD_COVER' => 'cover',
             'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
+            'FIELD_ALLOW_POST_TO' => 'allow_post_to',
             'FIELD_VIEWS' => 'views',
             'FIELD_COMMENTS' => 'comments',
             'FIELDS_QUICK_SEARCH' => array('fullname'),
@@ -121,6 +122,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'OBJECT_PAGE_VIEW_ENTRY' => 'bx_persons_view_profile',
             'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_persons_view_profile_closed',
             'OBJECT_PRIVACY_VIEW' => 'bx_persons_allow_view_to',
+            'OBJECT_PRIVACY_POST' => 'bx_persons_allow_post_to',
             'OBJECT_GRID_ADMINISTRATION' => 'bx_persons_administration',
             'OBJECT_GRID_COMMON' => 'bx_persons_common',
             'OBJECT_UPLOADERS_COVER' => array('bx_persons_cover_crop'),

+ 22 - 0
modules/boonex/persons/classes/BxPersonsPrivacyPost.php

@@ -0,0 +1,22 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Persons Persons
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxPersonsPrivacyPost extends BxBaseModProfilePrivacyPost
+{
+    function __construct($aOptions, $oTemplate = false)
+    {
+    	$this->_sModule = 'bx_persons';
+
+        parent::__construct($aOptions, $oTemplate);
+    }
+}
+
+/** @} */

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

@@ -30,6 +30,8 @@
     <string name="_bx_persons_form_profile_input_submit"><![CDATA[Submit]]></string>
     <string name="_bx_persons_form_profile_input_sys_allow_view_to"><![CDATA[Visible to]]></string>
     <string name="_bx_persons_form_profile_input_allow_view_to"><![CDATA[Visible to]]></string>
+    <string name="_bx_persons_form_profile_input_sys_allow_post_to"><![CDATA[Who can post]]></string>
+    <string name="_bx_persons_form_profile_input_allow_post_to"><![CDATA[Who can post]]></string>
 	<string name="_bx_persons_form_profile_input_sys_fullname"><![CDATA[Full Name]]></string>
 	<string name="_bx_persons_form_profile_input_fullname"><![CDATA[Full Name]]></string>
 	<string name="_bx_persons_form_profile_input_fullname_err"><![CDATA[This information is essential. Please, fill in this field.]]></string>

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

@@ -534,7 +534,8 @@ INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
 
 -- PRIVACY 
 INSERT INTO `sys_objects_privacy` (`object`, `module`, `action`, `title`, `default_group`, `spaces`, `table`, `table_field_id`, `table_field_author`, `override_class_name`, `override_class_file`) VALUES
-('bx_persons_allow_view_to', 'bx_persons', 'view', '_bx_persons_form_profile_input_allow_view_to', '3', '', 'bx_persons_data', 'id', 'author', 'BxPersonsPrivacy', 'modules/boonex/persons/classes/BxPersonsPrivacy.php');
+('bx_persons_allow_view_to', 'bx_persons', 'view', '_bx_persons_form_profile_input_allow_view_to', '3', '', 'bx_persons_data', 'id', 'author', 'BxPersonsPrivacy', 'modules/boonex/persons/classes/BxPersonsPrivacy.php'),
+('bx_persons_allow_post_to', 'bx_persons', 'post', '_bx_persons_form_profile_input_allow_post_to', '3', '', 'bx_persons_data', 'id', 'author', 'BxPersonsPrivacyPost', 'modules/boonex/persons/classes/BxPersonsPrivacyPost.php');
 
 -- EMAIL TEMPLATES
 INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `Body`) VALUES

+ 6 - 2
modules/boonex/persons/install/sql/install.sql

@@ -24,6 +24,7 @@ CREATE TABLE IF NOT EXISTS `bx_persons_data` (
   `reports` int(11) NOT NULL default '0',
   `featured` int(11) NOT NULL default '0',
   `allow_view_to` int(11) NOT NULL DEFAULT '3',
+  `allow_post_to` int(11) NOT NULL DEFAULT '3',
   PRIMARY KEY (`id`),
   FULLTEXT KEY `search_fields` (`fullname`,`description`)
 );
@@ -221,6 +222,7 @@ INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`,
 
 INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES 
 ('bx_person', 'bx_persons', 'allow_view_to', 3, '', 0, 'custom', '_bx_persons_form_profile_input_sys_allow_view_to', '_bx_persons_form_profile_input_allow_view_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('bx_person', 'bx_persons', 'allow_post_to', 3, '', 0, 'custom', '_bx_persons_form_profile_input_sys_allow_post_to', '_bx_persons_form_profile_input_allow_post_to', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_person', 'bx_persons', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_persons_form_profile_input_sys_delete_confirm', '_bx_persons_form_profile_input_delete_confirm', '_bx_persons_form_profile_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_persons_form_profile_input_delete_confirm_error', '', '', 1, 0),
 ('bx_person', 'bx_persons', 'do_submit', '_bx_persons_form_profile_input_submit', '', 0, 'submit', '_bx_persons_form_profile_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_person', 'bx_persons', 'description', '', '', 0, 'textarea', '_bx_persons_form_profile_input_sys_desc', '_bx_persons_form_profile_input_desc', '', 0, 0, 1, '', '', '', '', '', '', 'XssHtml', '', 1, 1),
@@ -245,7 +247,8 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_add', 'description', 2147483647, 1, 5),
 ('bx_person_add', 'location', 2147483647, 1, 6),
 ('bx_person_add', 'allow_view_to', 2147483647, 1, 7),
-('bx_person_add', 'do_submit', 2147483647, 1, 8),
+('bx_person_add', 'allow_post_to', 2147483647, 1, 8),
+('bx_person_add', 'do_submit', 2147483647, 1, 9),
 
 ('bx_person_delete', 'cover', 2147483647, 0, 0),
 ('bx_person_delete', 'picture', 2147483647, 0, 0),
@@ -260,7 +263,8 @@ INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for
 ('bx_person_edit', 'description', 2147483647, 1, 5),
 ('bx_person_edit', 'location', 2147483647, 1, 6),
 ('bx_person_edit', 'allow_view_to', 2147483647, 1, 7),
-('bx_person_edit', 'do_submit', 2147483647, 1, 8),
+('bx_person_edit', 'allow_post_to', 2147483647, 1, 8),
+('bx_person_edit', 'do_submit', 2147483647, 1, 9),
 
 ('bx_person_edit_cover', 'delete_confirm', 2147483647, 0, 1),
 ('bx_person_edit_cover', 'fullname', 2147483647, 0, 2),

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

@@ -34,6 +34,8 @@
     <string name="_bx_orgs_form_profile_input_allow_view_to"><![CDATA[Доступен для]]></string>
     <string name="_bx_orgs_form_profile_input_allow_view_to_info"><![CDATA[Закрытая - все могут найти группу и видеть кто в ней состоит, только участники могут видеть сообщения. Секретная - только участники могут найти группу и видеть сообщения.]]></string>
     <string name="_bx_orgs_form_profile_input_allow_view_notification_to"><![CDATA[Оповещения доступены для]]></string>
+    <string name="_bx_orgs_form_profile_input_sys_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
+    <string name="_bx_orgs_form_profile_input_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
     <string name="_bx_orgs_form_profile_input_sys_initial_members"><![CDATA[Пригласить участников]]></string>
     <string name="_bx_orgs_form_profile_input_initial_members"><![CDATA[Пригласить участников]]></string>
     <string name="_bx_orgs_form_profile_input_sys_org_name"><![CDATA[Название организации]]></string>
@@ -385,6 +387,7 @@
     <string name="_bx_orgs_txt_to_admins"><![CDATA[В админы]]></string>
     <string name="_bx_orgs_txt_from_admins"><![CDATA[Из админов]]></string>
     <string name="_bx_orgs_txt_private_organization"><![CDATA[Приватная организация]]></string>
+    <string name="_bx_orgs_ps_group_title_participants"><![CDATA[Сотрудники]]></string>
 
     <string name="_bx_orgs_email_friend_request"><![CDATA[Запрос на добавление в друзья]]></string>
     <string name="_bx_orgs_email_friend_request_subject"><![CDATA[Подружиться]]></string>

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

@@ -30,6 +30,8 @@
     <string name="_bx_persons_form_profile_input_submit"><![CDATA[Выполнить]]></string>
     <string name="_bx_persons_form_profile_input_sys_allow_view_to"><![CDATA[Доступен для]]></string>
     <string name="_bx_persons_form_profile_input_allow_view_to"><![CDATA[Доступен для]]></string>
+    <string name="_bx_persons_form_profile_input_sys_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
+    <string name="_bx_persons_form_profile_input_allow_post_to"><![CDATA[Оставлять сообщения в профиле могут]]></string>
 	<string name="_bx_persons_form_profile_input_sys_fullname"><![CDATA[Полное имя]]></string>
 	<string name="_bx_persons_form_profile_input_fullname"><![CDATA[Полное имя]]></string>
 	<string name="_bx_persons_form_profile_input_fullname_err"><![CDATA[Эта информация необходима. Пожалуйста, заполните это поле.]]></string>