1
0
Эх сурвалжийг харах

Merge branch 'master' of https://github.com/unaio/una

AntonLV 10 жил өмнө
parent
commit
7e7d3af6d3

+ 1 - 0
modules/boonex/convos/classes/BxCnvConfig.php

@@ -41,6 +41,7 @@ class BxCnvConfig extends BxBaseModTextConfig
             'FIELD_PHOTO' => 'attachments',
             'FIELD_PHOTO' => 'attachments',
             'FIELD_THUMB' => '',
             'FIELD_THUMB' => '',
             'FIELD_COMMENTS' => 'comments',
             'FIELD_COMMENTS' => 'comments',
+            'FIELD_ALLOW_EDIT' => 'allow_edit',
 
 
             // page URIs
             // page URIs
             'URI_VIEW_ENTRY' => 'view-convo',
             'URI_VIEW_ENTRY' => 'view-convo',

+ 9 - 3
modules/boonex/convos/classes/BxCnvFormEntry.php

@@ -119,6 +119,12 @@ class BxCnvFormEntry extends BxBaseModTextFormEntry
 
 
     function initChecker ($aValues = array (), $aSpecificValues = array())
     function initChecker ($aValues = array (), $aSpecificValues = array())
     {
     {
+        $CNF = $this->_oModule->_oConfig->CNF;
+        if (bx_get_logged_profile_id() != $aValues[$CNF['FIELD_AUTHOR']]) { // unset some fields for non author
+            unset($this->aInputs[$CNF['FIELD_ALLOW_EDIT']]);
+            unset($this->aInputs['recipients']);
+        }
+
         if ($iContentId = bx_get('draft_id')) { // if adding from draft, fill in existing fields info
         if ($iContentId = bx_get('draft_id')) { // if adding from draft, fill in existing fields info
             $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
             $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
             if ($aContentInfo)
             if ($aContentInfo)
@@ -129,9 +135,9 @@ class BxCnvFormEntry extends BxBaseModTextFormEntry
             $a = explode(',', $sProfilesIds);
             $a = explode(',', $sProfilesIds);
             $a = array_unique(BxDolFormCheckerHelper::passInt($a));
             $a = array_unique(BxDolFormCheckerHelper::passInt($a));
             if ($a)
             if ($a)
-                $aValues['recipients'] = array_merge(empty($aValues['recipients']) ? array() : $aValues['recipients'], $a);
-            
-        }
+                $aValues['recipients'] = array_merge(empty($aValues['recipients']) ? array() : $aValues['recipients'], $a);            
+        }        
+
         return parent::initChecker ($aValues, $aSpecificValues);
         return parent::initChecker ($aValues, $aSpecificValues);
     }
     }
 
 

+ 8 - 0
modules/boonex/convos/classes/BxCnvModule.php

@@ -310,6 +310,14 @@ class BxCnvModule extends BxBaseModTextModule
         return _t('_sys_txt_access_denied');
         return _t('_sys_txt_access_denied');
     }
     }
 
 
+    public function checkAllowedEdit ($aDataEntry, $isPerformAction = false)
+    {       
+        if ($aDataEntry[$this->_oConfig->CNF['FIELD_ALLOW_EDIT']] && $this->isCollaborator($aDataEntry, bx_get_logged_profile_id()))
+            return CHECK_ACTION_RESULT_ALLOWED;
+
+        return parent::checkAllowedEdit ($aDataEntry, $isPerformAction);
+    }
+    
     /**
     /**
      * Conversations can be deleted by author and/or collaborators only.
      * Conversations can be deleted by author and/or collaborators only.
      * Admins can't delete conversations, since it's designed for participant only, it's moved to trash actually, also it's private content.
      * Admins can't delete conversations, since it's designed for participant only, it's moved to trash actually, also it's private content.

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

@@ -27,6 +27,8 @@
     <string name="_bx_cnv_form_entry_input_sys_submit_text"><![CDATA[Draft status]]></string>
     <string name="_bx_cnv_form_entry_input_sys_submit_text"><![CDATA[Draft status]]></string>
     <string name="_bx_cnv_form_entry_input_sys_submit_block"><![CDATA[Submit block]]></string>
     <string name="_bx_cnv_form_entry_input_sys_submit_block"><![CDATA[Submit block]]></string>
     <string name="_bx_cnv_form_entry_input_sys_draft_id"><![CDATA[Draft ID]]></string>
     <string name="_bx_cnv_form_entry_input_sys_draft_id"><![CDATA[Draft ID]]></string>
+    <string name="_bx_cnv_form_entry_input_sys_allow_edit"><![CDATA[Main post editing by participants]]></string>
+    <string name="_bx_cnv_form_entry_input_allow_edit"><![CDATA[Main post editing by participants]]></string>
 
 
 	<string name="_bx_cnv_acl_action_create_entry"><![CDATA[New conversation]]></string>
 	<string name="_bx_cnv_acl_action_create_entry"><![CDATA[New conversation]]></string>
 	<string name="_bx_cnv_acl_action_delete_entry"><![CDATA[Delete conversation]]></string>
 	<string name="_bx_cnv_acl_action_delete_entry"><![CDATA[Delete conversation]]></string>

+ 12 - 8
modules/boonex/convos/install/sql/install.sql

@@ -7,6 +7,7 @@ CREATE TABLE IF NOT EXISTS `bx_convos_conversations` (
   `added` int(11) NOT NULL,
   `added` int(11) NOT NULL,
   `changed` int(11) NOT NULL,
   `changed` int(11) NOT NULL,
   `text` text NOT NULL,
   `text` text NOT NULL,
+  `allow_edit` tinyint(4) NOT NULL DEFAULT '0',
   `views` int(11) NOT NULL default '0',
   `views` int(11) NOT NULL default '0',
   `comments` int(11) NOT NULL default '0',
   `comments` int(11) NOT NULL default '0',
   `last_reply_timestamp` int(11) NOT NULL,
   `last_reply_timestamp` int(11) NOT NULL,
@@ -128,6 +129,7 @@ INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`,
 ('bx_convos', 'bx_convos_entry_view', 'bx_convos', 1, '_bx_cnv_form_entry_display_view');
 ('bx_convos', 'bx_convos_entry_view', 'bx_convos', 1, '_bx_cnv_form_entry_display_view');
 
 
 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 
 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_convos', 'bx_convos', 'allow_edit', 1, '', 0, 'switcher', '_bx_cnv_form_entry_input_sys_allow_edit', '_bx_cnv_form_entry_input_allow_edit', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
 ('bx_convos', 'bx_convos', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_cnv_form_entry_input_sys_delete_confirm', '_bx_cnv_form_entry_input_delete_confirm', '_bx_cnv_form_entry_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_cnv_form_entry_input_delete_confirm_error', '', '', 1, 0),
 ('bx_convos', 'bx_convos', 'delete_confirm', 1, '', 0, 'checkbox', '_bx_cnv_form_entry_input_sys_delete_confirm', '_bx_cnv_form_entry_input_delete_confirm', '_bx_cnv_form_entry_input_delete_confirm_info', 1, 0, 0, '', '', '', 'Avail', '', '_bx_cnv_form_entry_input_delete_confirm_error', '', '', 1, 0),
 ('bx_convos', 'bx_convos', 'do_submit', '_bx_cnv_form_entry_input_do_submit', '', 0, 'submit', '_bx_cnv_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_convos', 'bx_convos', 'do_submit', '_bx_cnv_form_entry_input_do_submit', '', 0, 'submit', '_bx_cnv_form_entry_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('bx_convos', 'bx_convos', 'submit_text', '', '', 0, 'custom', '_bx_cnv_form_entry_input_sys_submit_text', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
 ('bx_convos', 'bx_convos', 'submit_text', '', '', 0, 'custom', '_bx_cnv_form_entry_input_sys_submit_text', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
@@ -142,19 +144,21 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('bx_convos_entry_add', 'recipients', 2147483647, 1, 1),
 ('bx_convos_entry_add', 'recipients', 2147483647, 1, 1),
 ('bx_convos_entry_add', 'text', 2147483647, 1, 2),
 ('bx_convos_entry_add', 'text', 2147483647, 1, 2),
 ('bx_convos_entry_add', 'attachments', 2147483647, 1, 3),
 ('bx_convos_entry_add', 'attachments', 2147483647, 1, 3),
-('bx_convos_entry_add', 'submit_block', 2147483647, 1, 4),
-('bx_convos_entry_add', 'do_submit', 2147483647, 1, 5),
-('bx_convos_entry_add', 'submit_text', 2147483647, 1, 6),
-('bx_convos_entry_add', 'draft_id', 2147483647, 1, 7),
+('bx_convos_entry_add', 'allow_edit', 2147483647, 1, 4),
+('bx_convos_entry_add', 'submit_block', 2147483647, 1, 5),
+('bx_convos_entry_add', 'do_submit', 2147483647, 1, 6),
+('bx_convos_entry_add', 'submit_text', 2147483647, 1, 7),
+('bx_convos_entry_add', 'draft_id', 2147483647, 1, 8),
 
 
 ('bx_convos_entry_edit', 'delete_confirm', 2147483647, 0, 1),
 ('bx_convos_entry_edit', 'delete_confirm', 2147483647, 0, 1),
 ('bx_convos_entry_edit', 'recipients', 2147483647, 1, 2),
 ('bx_convos_entry_edit', 'recipients', 2147483647, 1, 2),
 ('bx_convos_entry_edit', 'text', 2147483647, 1, 3),
 ('bx_convos_entry_edit', 'text', 2147483647, 1, 3),
 ('bx_convos_entry_edit', 'attachments', 2147483647, 1, 4),
 ('bx_convos_entry_edit', 'attachments', 2147483647, 1, 4),
-('bx_convos_entry_edit', 'submit_block', 2147483647, 1, 5),
-('bx_convos_entry_edit', 'do_submit', 2147483647, 1, 6),
-('bx_convos_entry_edit', 'submit_text', 2147483647, 0, 7),
-('bx_convos_entry_edit', 'draft_id', 2147483647, 0, 8),
+('bx_convos_entry_edit', 'allow_edit', 2147483647, 1, 5),
+('bx_convos_entry_edit', 'submit_block', 2147483647, 1, 6),
+('bx_convos_entry_edit', 'do_submit', 2147483647, 1, 7),
+('bx_convos_entry_edit', 'submit_text', 2147483647, 0, 8),
+('bx_convos_entry_edit', 'draft_id', 2147483647, 0, 9),
 
 
 ('bx_convos_entry_view', 'delete_confirm', 2147483647, 0, 0),
 ('bx_convos_entry_view', 'delete_confirm', 2147483647, 0, 0),
 ('bx_convos_entry_view', 'do_submit', 2147483647, 0, 0),
 ('bx_convos_entry_view', 'do_submit', 2147483647, 0, 0),

+ 3 - 1
modules/boonex/russian/data/langs/bx_convos/ru.xml

@@ -27,7 +27,9 @@
     <string name="_bx_cnv_form_entry_input_sys_submit_text"><![CDATA[Статус черновика]]></string>
     <string name="_bx_cnv_form_entry_input_sys_submit_text"><![CDATA[Статус черновика]]></string>
     <string name="_bx_cnv_form_entry_input_sys_submit_block"><![CDATA[Блок отправки сообщения]]></string>
     <string name="_bx_cnv_form_entry_input_sys_submit_block"><![CDATA[Блок отправки сообщения]]></string>
     <string name="_bx_cnv_form_entry_input_sys_draft_id"><![CDATA[ID черновика]]></string>
     <string name="_bx_cnv_form_entry_input_sys_draft_id"><![CDATA[ID черновика]]></string>
-
+    <string name="_bx_cnv_form_entry_input_sys_allow_edit"><![CDATA[Редактирование главного сообщения участниками]]></string>
+    <string name="_bx_cnv_form_entry_input_allow_edit"><![CDATA[Редактирование главного сообщения участниками]]></string>
+    
 	<string name="_bx_cnv_acl_action_create_entry"><![CDATA[Новое сообщение]]></string>
 	<string name="_bx_cnv_acl_action_create_entry"><![CDATA[Новое сообщение]]></string>
 	<string name="_bx_cnv_acl_action_delete_entry"><![CDATA[Удалить сообщение]]></string>
 	<string name="_bx_cnv_acl_action_delete_entry"><![CDATA[Удалить сообщение]]></string>
 	<string name="_bx_cnv_acl_action_view_entry"><![CDATA[Просмотреть сообщение]]></string>
 	<string name="_bx_cnv_acl_action_view_entry"><![CDATA[Просмотреть сообщение]]></string>