AntonLV 9 лет назад
Родитель
Сommit
ab399c1f0e

+ 46 - 11
modules/boonex/convos/classes/BxCnvCmts.php

@@ -11,6 +11,33 @@
 
 class BxCnvCmts extends BxTemplCmts
 {
+    protected $_sModule;
+    protected $_oModule;
+
+    function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_convos';
+        $this->_oModule = BxDolModule::getInstance($this->_sModule);
+
+        parent::__construct($sSystem, $iId, $iInit, $oTemplate);
+    }
+
+    public function getObjectTitle ($iObjectId = 0)
+    {
+    	$sResult = parent::getObjectTitle($iObjectId);
+    	if(!empty($sResult))
+    		return strmaxtextlen($sResult, 20, '...');
+
+        return $sResult;
+    }
+
+    public function addCssJs()
+    {
+        parent::addCssJs();
+
+        $this->_oModule->_oTemplate->addCss(array('cmts.css'));
+    }
+
     /**
      * Comments are enabled for collaborators only
      */
@@ -19,11 +46,10 @@ class BxCnvCmts extends BxTemplCmts
         if (!parent::isEnabled ())
             return false;
 
-        $oModule = BxDolModule::getInstance('bx_convos');
-        if (!$oModule->_oDb->getContentInfoById((int)$this->getId()))
+        if (!$this->_oModule->_oDb->getContentInfoById((int)$this->getId()))
             return false;
 
-        $aCollaborators = $oModule->_oDb->getCollaborators((int)$this->getId());
+        $aCollaborators = $this->_oModule->_oDb->getCollaborators((int)$this->getId());
         if (!isset($aCollaborators[bx_get_logged_profile_id()]))
             return false;
 
@@ -53,20 +79,29 @@ class BxCnvCmts extends BxTemplCmts
         return $this->msgErrRemoveAllowed ();
     }
 
-    protected function _getFormObject($sAction = BX_CMT_ACTION_POST)
-    {
-        $oForm = parent::_getFormObject($sAction);
-        $oForm->aInputs['cmt_submit']['value'] = _t('_sys_send');
-        return $oForm;
-    }
-
-    function getCommentsBlock($aBp = array(), $aDp = array())
+    public function getCommentsBlock($aBp = array(), $aDp = array())
     {
         $mixedBlock = parent::getCommentsBlock($aBp, $aDp);
         if (is_array($mixedBlock) && isset($mixedBlock['title']))
             $mixedBlock['title'] = _t('_bx_cnv_page_block_title_entry_comments', $this->getCommentsCount());
+
         return $mixedBlock;
     }
+
+    public function getCommentBlock($iCmtId = 0, $aBp = array(), $aDp = array())
+    {
+        if(!$this->isEnabled())
+            return '';
+
+        return parent::getCommentBlock($iCmtId, $aBp, $aDp);
+    }
+
+    protected function _getFormObject($sAction = BX_CMT_ACTION_POST)
+    {
+        $oForm = parent::_getFormObject($sAction);
+        $oForm->aInputs['cmt_submit']['value'] = _t('_sys_send');
+        return $oForm;
+    }
 }
 
 /** @} */

+ 1 - 1
modules/boonex/convos/install/sql/enable.sql

@@ -184,7 +184,7 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 
 -- COMMENTS
 INSERT INTO `sys_objects_cmts` (`Name`, `Module`, `Table`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Nl2br`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `BaseUrl`, `ObjectVote`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldTitle`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
-('bx_convos', 'bx_convos', 'bx_convos_cmts', 1, 5000, 1000, 1, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-convo&id={object_id}', '', 'bx_convos_conversations', 'id', 'author', '', 'comments', 'BxCnvCmts', 'modules/boonex/convos/classes/BxCnvCmts.php');
+('bx_convos', 'bx_convos', 'bx_convos_cmts', 1, 5000, 1000, 1, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-convo&id={object_id}', '', 'bx_convos_conversations', 'id', 'author', 'text', 'comments', 'BxCnvCmts', 'modules/boonex/convos/classes/BxCnvCmts.php');
 
 
 -- VIEWS

+ 3 - 0
modules/boonex/convos/template/css/cmts.css

@@ -0,0 +1,3 @@
+form.cmt-post-reply .bx-form-input-textarea {
+    height: 11rem;
+}