Преглед изворни кода

Ticket #2213 - Improvements and bug fixes after the first testing.

AntonLV пре 7 година
родитељ
комит
fb962ae4c2

+ 61 - 38
inc/classes/BxDolCmts.php

@@ -643,6 +643,17 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return $this->_oQuery->getComments ($this->getId(), $iVParentId, $this->_getAuthorId(), $sFilter, $aOrder, $iStart, $iCount);
         return $this->_oQuery->getComments ($this->getId(), $iVParentId, $this->_getAuthorId(), $sFilter, $aOrder, $iStart, $iCount);
     }
     }
 
 
+    /**
+     * Get comment's short info.
+     */
+    public function getCommentSimple ($iCmtId)
+    {
+        return $this->_oQuery->getCommentSimple ($this->getId(), $iCmtId);
+    }
+
+    /**
+     * Get comment's full info.
+     */
     public function getCommentRow ($iCmtId)
     public function getCommentRow ($iCmtId)
     {
     {
         return $this->_oQuery->getComment ($this->getId(), $iCmtId);
         return $this->_oQuery->getComment ($this->getId(), $iCmtId);
@@ -840,7 +851,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return $oReport->isAllowedReport($isPerformAction);
         return $oReport->isAllowedReport($isPerformAction);
     }
     }
 
 
-    public function isPostReplyAllowed ($isPerformAction = false)
+    public function isPostAllowed ($isPerformAction = false)
     {
     {
         $mixedResult = BxDolService::call($this->_aSystem['module'], 'check_allowed_comments_post', array($this->getId(), $this->getSystemName()));
         $mixedResult = BxDolService::call($this->_aSystem['module'], 'check_allowed_comments_post', array($this->getId(), $this->getSystemName()));
         if($mixedResult !== CHECK_ACTION_RESULT_ALLOWED)
         if($mixedResult !== CHECK_ACTION_RESULT_ALLOWED)
@@ -849,11 +860,27 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return $this->checkAction ('comments post', $isPerformAction);
         return $this->checkAction ('comments post', $isPerformAction);
     }
     }
 
 
-    public function msgErrPostReplyAllowed ()
+    public function msgErrPostAllowed ()
     {
     {
         return $this->checkActionErrorMsg('comments post');
         return $this->checkActionErrorMsg('comments post');
     }
     }
 
 
+    /**
+     * Determines whether a 'reply' action allowed or not.
+     * @param integer or array $mixedCmt - ID or an array which describes the comment to be replied
+     * @param boolean $isPerformAction
+     * @return boolean
+     */
+    public function isReplyAllowed ($mixedCmt, $isPerformAction = false)
+    {
+        return $this->isPostAllowed($isPerformAction);
+    }
+
+    public function msgErrReplyAllowed ()
+    {
+        return $this->msgErrPostAllowed ();
+    }
+
     public function isEditAllowed ($aCmt, $isPerformAction = false)
     public function isEditAllowed ($aCmt, $isPerformAction = false)
     {
     {
         if(isAdmin())
         if(isAdmin())
@@ -937,10 +964,8 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
 
 
     public function actionGetFormEdit ()
     public function actionGetFormEdit ()
     {
     {
-        if (!$this->isEnabled()){
-            echoJson(array());
-            return;
-        }
+        if (!$this->isEnabled())
+            return echoJson(array());
 
 
         $iCmtId = bx_process_input(bx_get('Cmt'), BX_DATA_INT);
         $iCmtId = bx_process_input(bx_get('Cmt'), BX_DATA_INT);
         echoJson($this->getFormEdit($iCmtId, array('dynamic_mode' => true)));
         echoJson($this->getFormEdit($iCmtId, array('dynamic_mode' => true)));
@@ -975,18 +1000,16 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
             return '';
             return '';
 
 
         $aBp = $aDp = array();
         $aBp = $aDp = array();
-		$this->_getParams($aBp, $aDp);
+        $this->_getParams($aBp, $aDp);
 
 
-		$aDp['dynamic_mode'] = true;
+        $aDp['dynamic_mode'] = true;
         return $this->getComments($aBp, $aDp);
         return $this->getComments($aBp, $aDp);
     }
     }
 
 
     public function actionSubmitPostForm()
     public function actionSubmitPostForm()
     {
     {
-        if(!$this->isEnabled() || !$this->isPostReplyAllowed()) {
-            echoJson(array());
-            return;
-        }
+        if(!$this->isEnabled())
+            return echoJson(array());
 
 
         $iCmtParentId = 0;
         $iCmtParentId = 0;
         if(bx_get('cmt_parent_id') !== false)
         if(bx_get('cmt_parent_id') !== false)
@@ -1131,54 +1154,54 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         if(empty($aCmt) || !is_array($aCmt))
         if(empty($aCmt) || !is_array($aCmt))
             return false;
             return false;
 
 
+        $iCmtPrntId = (int)$aCmt['cmt_parent_id'];
         $iPerformerId = (int)$aCmt['cmt_author_id'];
         $iPerformerId = (int)$aCmt['cmt_author_id'];
         bx_alert($this->_sSystem, 'commentPost', $iObjId, $iPerformerId, array(
         bx_alert($this->_sSystem, 'commentPost', $iObjId, $iPerformerId, array(
-			'object_author_id' => $iObjAthrId,
+            'object_author_id' => $iObjAthrId,
 
 
-        	'comment_id' => $iCmtId, 
-        	'comment_author_id' => $aCmt['cmt_author_id'], 
-        	'comment_text' => $aCmt['cmt_text']
+            'comment_id' => $iCmtId, 
+            'comment_author_id' => $aCmt['cmt_author_id'], 
+            'comment_text' => $aCmt['cmt_text']
         ));
         ));
 
 
         bx_alert('comment', 'added', $iCmtId, $iPerformerId, array(
         bx_alert('comment', 'added', $iCmtId, $iPerformerId, array(
-        	'object_system' => $this->_sSystem, 
-        	'object_id' => $iObjId, 
-        	'object_author_id' => $iObjAthrId,
+            'object_system' => $this->_sSystem, 
+            'object_id' => $iObjId, 
+            'object_author_id' => $iObjAthrId,
 
 
-        	'comment_author_id' => $aCmt['cmt_author_id'], 
-        	'comment_text' => $aCmt['cmt_text']
+            'comment_author_id' => $aCmt['cmt_author_id'], 
+            'comment_text' => $aCmt['cmt_text']
         ));
         ));
 
 
-        if(!empty($aCmt['cmt_parent_id'])) {
-            $iCmtPrntId = (int)$aCmt['cmt_parent_id'];
+        if(!empty($iCmtPrntId)) {
             $aCmtPrnt = $this->_oQuery->getCommentSimple($iObjId, $iCmtPrntId);
             $aCmtPrnt = $this->_oQuery->getCommentSimple($iObjId, $iCmtPrntId);
             if(!empty($aCmtPrnt) && is_array($aCmtPrnt)) {
             if(!empty($aCmtPrnt) && is_array($aCmtPrnt)) {
                 bx_alert($this->_sSystem, 'replyPost', $iCmtPrntId, $iPerformerId, array(
                 bx_alert($this->_sSystem, 'replyPost', $iCmtPrntId, $iPerformerId, array(
                     'object_id' => $iObjId, 
                     'object_id' => $iObjId, 
                     'object_author_id' => $iObjAthrId,
                     'object_author_id' => $iObjAthrId,
 
 
-                	'parent_author_id' => $aCmtPrnt['cmt_author_id'],
+                    'parent_author_id' => $aCmtPrnt['cmt_author_id'],
 
 
-                	'comment_id' => $iCmtId,
-                	'comment_author_id' => $aCmt['cmt_author_id'], 
-                	'comment_text' => $aCmt['cmt_text']
+                    'comment_id' => $iCmtId,
+                    'comment_author_id' => $aCmt['cmt_author_id'], 
+                    'comment_text' => $aCmt['cmt_text']
                 ));
                 ));
 
 
                 bx_alert('comment', 'replied', $iCmtId, $iPerformerId, array(
                 bx_alert('comment', 'replied', $iCmtId, $iPerformerId, array(
-                	'object_system' => $this->_sSystem, 
-                	'object_id' => $iObjId, 
-                	'object_author_id' => $iObjAthrId,
- 
-                	'parent_id' => $iCmtPrntId,
-                	'parent_author_id' => $aCmtPrnt['cmt_author_id'],
-
-                	'comment_author_id' => $aCmt['cmt_author_id'],  
-                	'comment_text' => $aCmt['cmt_text']
+                    'object_system' => $this->_sSystem, 
+                    'object_id' => $iObjId, 
+                    'object_author_id' => $iObjAthrId,
+
+                    'parent_id' => $iCmtPrntId,
+                    'parent_author_id' => $aCmtPrnt['cmt_author_id'],
+
+                    'comment_author_id' => $aCmt['cmt_author_id'],  
+                    'comment_text' => $aCmt['cmt_text']
                 ));
                 ));
             }
             }
         }
         }
 
 
-        return true;
+        return array('id' => $iCmtId, 'parent_id' => $iCmtPrntId);
     }
     }
 
 
     public function onEditAfter($iCmtId)
     public function onEditAfter($iCmtId)
@@ -1208,7 +1231,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
             'comment_text' => $aCmt['cmt_text']
             'comment_text' => $aCmt['cmt_text']
         ));
         ));
 
 
-        return true;
+        return array('id' => $iCmtId, 'text' => $this->_prepareTextForOutput($aCmt['cmt_text'], $iCmtId));
     }
     }
 
 
     public function serviceGetAuthor ($iContentId)
     public function serviceGetAuthor ($iContentId)

+ 15 - 3
inc/classes/BxDolCmtsQuery.php

@@ -205,14 +205,26 @@ class BxDolCmtsQuery extends BxDolDb
                 break;
                 break;
 
 
             case 'object_id':
             case 'object_id':
-        		$aMethod['params'][1]['cmt_object_id'] = (int)$aParams['object_id'];
+                $aMethod['params'][1]['cmt_object_id'] = (int)$aParams['object_id'];
 
 
-        		$sWhereClause .= " AND `{$this->_sTable}`.`cmt_object_id` = :cmt_object_id";
+                $sWhereClause .= " AND `{$this->_sTable}`.`cmt_object_id` = :cmt_object_id";
 
 
                 $sOrderClause = "`{$this->_sTable}`.`cmt_time` ASC";
                 $sOrderClause = "`{$this->_sTable}`.`cmt_time` ASC";
                 $sLimitClause = "";
                 $sLimitClause = "";
                 if(isset($aParams['per_page']))
                 if(isset($aParams['per_page']))
-                	$sLimitClause = $this->prepareAsString("?, ?", $aParams['start'], $aParams['per_page']);
+                    $sLimitClause = $this->prepareAsString("?, ?", $aParams['start'], $aParams['per_page']);
+
+                break;
+
+            case 'author_id':
+                $aMethod['params'][1]['cmt_author_id'] = (int)$aParams['author_id'];
+
+                $sWhereClause .= " AND `{$this->_sTable}`.`cmt_author_id` = :cmt_author_id";
+
+                $sOrderClause = "`{$this->_sTable}`.`cmt_time` ASC";
+                $sLimitClause = "";
+                if(isset($aParams['per_page']))
+                    $sLimitClause = $this->prepareAsString("?, ?", $aParams['start'], $aParams['per_page']);
 
 
                 break;
                 break;
 
 

+ 94 - 2
inc/classes/BxDolCmtsReviews.php

@@ -20,6 +20,25 @@ class BxDolCmtsReviews extends BxTemplCmts
 
 
     protected $_sRatingLegendId;
     protected $_sRatingLegendId;
 
 
+    /*
+     * Determines whether an object author is allowed 
+     * to post review to his own content.
+     */
+    protected $_bOaPostAllowed;
+
+    /*
+     * Determines whether an object author is allowed 
+     * to reply to somebody's review.
+     */
+    protected $_bOaReplyAllowed;
+
+    /*
+     * Determines whether a review author is allowed 
+     * to reply to his own review or to somebody's reply 
+     * to his own review.
+     */
+    protected $_bRaReplyAllowed;
+
     public function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
     public function __construct($sSystem, $iId, $iInit = true, $oTemplate = false)
     {
     {
         parent::__construct($sSystem, $iId, $iInit, $oTemplate);
         parent::__construct($sSystem, $iId, $iInit, $oTemplate);
@@ -46,6 +65,60 @@ class BxDolCmtsReviews extends BxTemplCmts
         $this->_sMoodLegendId = "cmt-legend-%s-%d-%d";
         $this->_sMoodLegendId = "cmt-legend-%s-%d-%d";
 
 
         $this->_sRatingLegendId = "cmt-legend-%s-%d";
         $this->_sRatingLegendId = "cmt-legend-%s-%d";
+
+        $this->_bOaPostAllowed = true;
+        $this->_bOaReplyAllowed = true;
+        $this->_bRaReplyAllowed = true;
+    }
+
+    public function isPostAllowed($isPerformAction = false)
+    {
+        $iUsrId = $this->_getAuthorId();
+        $iObjAthrId = $this->getObjectAuthorId();
+
+        if($iUsrId == $iObjAthrId && !$this->_bOaPostAllowed)
+            return false;
+
+        if($this->isReviewed($iUsrId))
+            return false;
+
+        if($this->isPostAllowedCustom($isPerformAction) === false)
+            return false;
+
+        return parent::isPostAllowed($isPerformAction);
+    }
+
+    public function isReplyAllowed ($mixedCmt, $isPerformAction = false)
+    {
+        $iUsrId = $this->_getAuthorId();
+        $iObjAthrId = $this->getObjectAuthorId();
+        $iRvwAthrId = $this->getReviewAuthorId($mixedCmt);
+
+        if(!in_array($iUsrId, array($iObjAthrId, $iRvwAthrId)))
+            return false;
+
+        if($iUsrId == $iObjAthrId && $iUsrId != $iRvwAthrId && !$this->_bOaReplyAllowed)
+            return false;
+
+        if($iUsrId == $iRvwAthrId && !$this->_bRaReplyAllowed)
+            return false;
+
+        return parent::isPostAllowed($isPerformAction);
+    }
+
+    /**
+     * Can be overwritten if some custom check is needed.
+     * @param boolean $isPerformAction
+     * @return boolean
+     */
+    public function isPostAllowedCustom($isPerformAction = false)
+    {
+        return true;
+    }
+
+    public function isReviewed($mixedCmt)
+    {
+        return $this->_oQuery->isReviewed($this->getId(), $mixedCmt);
     }
     }
 
 
     public function getMoodMinValue()
     public function getMoodMinValue()
@@ -68,6 +141,25 @@ class BxDolCmtsReviews extends BxTemplCmts
         return sprintf($this->_sRatingLegendId, str_replace('_', '-', $this->getSystemName()), $this->getId());
         return sprintf($this->_sRatingLegendId, str_replace('_', '-', $this->getSystemName()), $this->getId());
     }
     }
 
 
+    public function getReviewAuthorId($mixedCmt)
+    {
+        return $this->_oQuery->getReviewAuthorId($this->getId(), $mixedCmt);
+    }
+
+    public function onEditAfter($iCmtId)
+    {
+        $mixedResult = parent::onEditAfter($iCmtId);
+        if($mixedResult === false)
+            return $mixedResult;
+
+        $aCmt = $this->getCommentSimple($iCmtId);
+
+        return array_merge($mixedResult, array(
+            'mood' => (int)$aCmt['cmt_mood'],
+            'mood_legend_id' => $this->getMoodLegendId($iCmtId)
+        ));
+    }
+
     protected function _triggerComment()
     protected function _triggerComment()
     {
     {
         $mixedResult = parent::_triggerComment();
         $mixedResult = parent::_triggerComment();
@@ -75,8 +167,8 @@ class BxDolCmtsReviews extends BxTemplCmts
             return $mixedResult;
             return $mixedResult;
 
 
         $iId = $this->getId();
         $iId = $this->getId();
-        $fAvg = $this->_oQuery->getReviewsAvg($iId);
-        return $this->_oQuery->updateTriggerTableAvg($iId, $fAvg);
+        $aStats = $this->_oQuery->getReviewsStats($iId);
+        return $this->_oQuery->updateTriggerTableAvg($iId, (float)$aStats['avg']);
     }
     }
 }
 }
 
 

+ 21 - 3
inc/classes/BxDolCmtsReviewsQuery.php

@@ -17,7 +17,25 @@ class BxDolCmtsReviewsQuery extends BxDolCmtsQuery
         parent::__construct($oMain);
         parent::__construct($oMain);
     }
     }
 
 
-    function getReviewsAvg ($iId, $iCmtVParentId = -1, $iAuthorId = 0, $sFilter = '')
+    public function isReviewed($iId, $iAuthorId)
+    {
+        $aReviews = $this->getCommentsBy(array('type' => 'author_id', 'author_id' => $iAuthorId, 'object_id' => $iId));
+
+        return !empty($aReviews) && is_array($aReviews);
+    }
+
+    public function getReviewAuthorId($iId, $mixedCmt)
+    {
+        if(!is_array($mixedCmt))
+            $mixedCmt = $this->getCommentSimple($iId, (int)$mixedCmt);
+
+        if((int)$mixedCmt['cmt_parent_id'] == 0)
+            return (int)$mixedCmt['cmt_author_id'];
+
+        return (int)$this->getReviewAuthorId($iId, $mixedCmt['cmt_parent_id']);
+    }
+
+    public function getReviewsStats ($iId, $iCmtVParentId = -1, $iAuthorId = 0, $sFilter = '')
     {
     {
     	$aBindings = array(
     	$aBindings = array(
             'cmt_object_id' => $iId
             'cmt_object_id' => $iId
@@ -47,10 +65,10 @@ class BxDolCmtsReviewsQuery extends BxDolCmtsQuery
                 break;
                 break;
         }
         }
 
 
-        return (float)$this->getOne("SELECT SUM(`cmt_mood`)/COUNT(*) FROM `{$this->_sTable}` $sJoinClause WHERE 1 " . $sWhereClause, $aBindings);
+        return $this->getRow("SELECT COUNT(*) as `count`, SUM(`cmt_mood`)/COUNT(*) AS `avg` FROM `{$this->_sTable}` $sJoinClause WHERE 1 " . $sWhereClause, $aBindings);
     }
     }
 
 
-    function updateTriggerTableAvg($iId, $fAvg)
+    public function updateTriggerTableAvg($iId, $fAvg)
     {
     {
         $sField = $this->_sTriggerFieldComments . '_avg';
         $sField = $this->_sTriggerFieldComments . '_avg';
         return $this->query("UPDATE `{$this->_sTriggerTable}` SET `{$sField}` = :avg WHERE `{$this->_sTriggerFieldId}` = :id LIMIT 1", array(
         return $this->query("UPDATE `{$this->_sTriggerTable}` SET `{$sField}` = :avg WHERE `{$this->_sTriggerFieldId}` = :id LIMIT 1", array(

+ 24 - 25
inc/js/classes/BxDolCmts.js

@@ -146,35 +146,34 @@ BxDolCmts.prototype.cmtBeforeEditSubmit = function(oCmtForm)
 	this._loadingInButton($(oCmtForm).children().find(':submit'), true);
 	this._loadingInButton($(oCmtForm).children().find(':submit'), true);
 };
 };
 
 
-BxDolCmts.prototype.cmtAfterEditSubmit = function (oCmtForm, oData)
+BxDolCmts.prototype.cmtAfterEditSubmit = function (oCmtForm, oData, onComplete)
 {
 {
-	var $this = this;
-	var fContinue = function() {
-		if(oData && oData.id != undefined && oData.text != undefined) {
-			var iCmtId = parseInt(oData.id);
-			if(iCmtId > 0) {
-				$('#cmt' + iCmtId + ' .cmt-body').bx_anim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
-					$(this).html(oData.text).bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
-				});
-	        }
-
-	        return;
-		}
-
-		if(oData && oData.form != undefined && oData.form_id != undefined) {
-			$('#' + oData.form_id).replaceWith(oData.form);
-			$this.cmtInitFormEdit(oData.form_id);
-
-			return;
-		}
-	};
+    var $this = this;
+    var fContinue = function() {
+        if(oData && oData.id != undefined && oData.text != undefined) {
+            var iCmtId = parseInt(oData.id);
+            if(iCmtId > 0) {
+                $('#cmt' + iCmtId + ' .cmt-body').bx_anim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
+                    $(this).html(oData.text).bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed);
+                });
+            }
+        }
 
 
-	this._loadingInButton($(oCmtForm).children().find(':submit'), false);
+        if(oData && oData.form != undefined && oData.form_id != undefined) {
+            $('#' + oData.form_id).replaceWith(oData.form);
+            $this.cmtInitFormEdit(oData.form_id);
+        }
 
 
-	if(oData && oData.msg != undefined)
+        if(typeof onComplete == 'function')
+            onComplete(oCmtForm, oData);
+    };
+
+    this._loadingInButton($(oCmtForm).children().find(':submit'), false);
+
+    if(oData && oData.msg != undefined)
         bx_alert(oData.msg, fContinue);
         bx_alert(oData.msg, fContinue);
-	else 
-		fContinue();
+    else 
+            fContinue();
 };
 };
 
 
 BxDolCmts.prototype.cmtEdit = function(oLink, iCmtId) {
 BxDolCmts.prototype.cmtEdit = function(oLink, iCmtId) {

+ 13 - 0
inc/js/classes/BxDolCmtsReviews.js

@@ -29,6 +29,19 @@ BxDolCmtsReviews.prototype.cmtInit = function ()
     BxDolCmts.prototype.cmtInit.call(this);
     BxDolCmts.prototype.cmtInit.call(this);
 };
 };
 
 
+BxDolCmtsReviews.prototype.cmtAfterEditSubmit = function (oCmtForm, oData, onComplete)
+{
+    var $this = this;
+
+    BxDolCmts.prototype.cmtAfterEditSubmit.call(this, oCmtForm, oData, function() {
+        if(oData && oData.mood != undefined && oData.mood_legend_id != undefined)
+            $this.cmtInitRating($('#' + oData.mood_legend_id).attr('cmt-rating-data', oData.mood));
+
+        if(typeof onComplete == 'function')
+            onComplete(oCmtForm, oData);
+    });
+};
+
 BxDolCmtsReviews.prototype.cmtInitRating = function(oElement)
 BxDolCmtsReviews.prototype.cmtInitRating = function(oElement)
 {
 {
     var fValue = oElement.attr(this._sAttributeRating);
     var fValue = oElement.attr(this._sAttributeRating);

+ 1 - 1
modules/boonex/albums/classes/BxAlbumsCmtsMedia.php

@@ -35,7 +35,7 @@ class BxAlbumsCmtsMedia extends BxTemplCmts
         return CHECK_ACTION_RESULT_ALLOWED;
         return CHECK_ACTION_RESULT_ALLOWED;
     }
     }
 
 
-    public function isPostReplyAllowed ($isPerformAction = false)
+    public function isPostAllowed ($isPerformAction = false)
     {
     {
         $CNF = $this->_oModule->_oConfig->CNF;
         $CNF = $this->_oModule->_oConfig->CNF;
 
 

+ 10 - 10
modules/boonex/directory/install/sql/enable.sql

@@ -46,19 +46,19 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 
 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
 INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title_system`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `active`, `order`) VALUES 
 ('bx_directory_view_entry', 1, 'bx_directory', '', '_bx_directory_page_block_title_entry_breadcrumb', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:17:"entity_breadcrumb";}', 0, 0, 1, 1),
 ('bx_directory_view_entry', 1, 'bx_directory', '', '_bx_directory_page_block_title_entry_breadcrumb', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:17:"entity_breadcrumb";}', 0, 0, 1, 1),
-('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_reviews', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:14:"entity_reviews";}', 0, 0, 0, 0),
+('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_comments', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:15:"entity_comments";}', 0, 0, 0, 0),
 ('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_author', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:13:"entity_author";}', 0, 0, 1, 1),
 ('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_author', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:13:"entity_author";}', 0, 0, 1, 1),
-('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_text', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:17:"entity_text_block";}', 0, 0, 1, 2),
-('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_all_actions', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:18:"entity_all_actions";}', 0, 0, 1, 3),
-('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_attachments', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:18:"entity_attachments";}', 0, 0, 1, 4),
-('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_comments', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:15:"entity_comments";}', 0, 0, 1, 5),
-('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_reviews_rating', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:21:"entity_reviews_rating";}', 0, 0, 0, 0),
+('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_text', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:17:"entity_text_block";}', 0, 0, 1, 10),
+('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_all_actions', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:18:"entity_all_actions";}', 0, 0, 1, 20),
+('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_attachments', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:18:"entity_attachments";}', 0, 0, 1, 30),
+('bx_directory_view_entry', 2, 'bx_directory', '', '_bx_directory_page_block_title_entry_reviews', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:14:"entity_reviews";}', 0, 0, 1, 40),
 ('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_location', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:15:"entity_location";}', 0, 0, 0, 0),
 ('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_location', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:15:"entity_location";}', 0, 0, 0, 0),
 ('bx_directory_view_entry', 3, 'bx_directory', '_bx_directory_page_block_title_sys_entry_context', '_bx_directory_page_block_title_entry_context', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:14:"entity_context";}', 0, 0, 1, 1),
 ('bx_directory_view_entry', 3, 'bx_directory', '_bx_directory_page_block_title_sys_entry_context', '_bx_directory_page_block_title_entry_context', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:14:"entity_context";}', 0, 0, 1, 1),
-('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_info', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:11:"entity_info";}', 0, 0, 1, 2),
-('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_location', 3, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:13:"locations_map";s:6:"params";a:2:{i:0;s:12:"bx_directory";i:1;s:4:"{id}";}s:5:"class";s:20:"TemplServiceMetatags";}', 0, 0, 1, 3),
-('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_polls', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:12:"entity_polls";}', 0, 0, 1, 4),
-('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_featured_entries_view_extended', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:12:"bx_directory";s:6:"method";s:15:"browse_featured";s:6:"params";a:1:{i:0;s:8:"extended";}}', 0, 0, 1, 5),
+('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_info', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:11:"entity_info";}', 0, 0, 1, 10),
+('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_reviews_rating', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:21:"entity_reviews_rating";}', 0, 0, 1, 20),
+('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_location', 3, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:13:"locations_map";s:6:"params";a:2:{i:0;s:12:"bx_directory";i:1;s:4:"{id}";}s:5:"class";s:20:"TemplServiceMetatags";}', 0, 0, 1, 30),
+('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_entry_polls', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:12:"entity_polls";}', 0, 0, 1, 40),
+('bx_directory_view_entry', 3, 'bx_directory', '', '_bx_directory_page_block_title_featured_entries_view_extended', 11, 2147483647, 'service', 'a:3:{s:6:"module";s:12:"bx_directory";s:6:"method";s:15:"browse_featured";s:6:"params";a:1:{i:0;s:8:"extended";}}', 0, 0, 1, 50),
 ('bx_directory_view_entry', 4, 'bx_directory', '', '_bx_directory_page_block_title_entry_actions', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:14:"entity_actions";}', 0, 0, 0, 0),
 ('bx_directory_view_entry', 4, 'bx_directory', '', '_bx_directory_page_block_title_entry_actions', 13, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:14:"entity_actions";}', 0, 0, 0, 0),
 ('bx_directory_view_entry', 4, 'bx_directory', '', '_bx_directory_page_block_title_entry_social_sharing', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:21:"entity_social_sharing";}', 0, 0, 0, 0);
 ('bx_directory_view_entry', 4, 'bx_directory', '', '_bx_directory_page_block_title_entry_social_sharing', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:12:"bx_directory";s:6:"method";s:21:"entity_social_sharing";}', 0, 0, 0, 0);
 
 

+ 1 - 1
modules/boonex/directory/install/sql/install.sql

@@ -674,7 +674,7 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 -- COMMENTS
 -- COMMENTS
 INSERT INTO `sys_objects_cmts` (`Name`, `Module`, `Table`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Html`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `BaseUrl`, `ObjectVote`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldTitle`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
 INSERT INTO `sys_objects_cmts` (`Name`, `Module`, `Table`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Html`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `BaseUrl`, `ObjectVote`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldTitle`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
 ('bx_directory', 'bx_directory', 'bx_directory_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-post&id={object_id}', '', 'bx_directory_entries', 'id', 'author', 'title', 'comments', '', ''),
 ('bx_directory', 'bx_directory', 'bx_directory_cmts', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-post&id={object_id}', '', 'bx_directory_entries', 'id', 'author', 'title', 'comments', '', ''),
-('bx_directory_reviews', 'bx_directory', 'bx_directory_reviews', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', 'page.php?i=view-post&id={object_id}', '', 'bx_directory_entries', 'id', 'author', 'title', 'reviews', 'BxTemplCmtsReviews', '');
+('bx_directory_reviews', 'bx_directory', 'bx_directory_reviews', 1, 5000, 1000, 3, 5, 3, 'tail', 1, 'bottom', 1, 0, 1, -3, 1, 'cmt', 'page.php?i=view-post&id={object_id}', '', 'bx_directory_entries', 'id', 'author', 'title', 'reviews', 'BxTemplCmtsReviews', '');
 
 
 -- VOTES
 -- VOTES
 INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 
 INSERT INTO `sys_objects_vote` (`Name`, `TableMain`, `TableTrack`, `PostTimeout`, `MinValue`, `MaxValue`, `IsUndo`, `IsOn`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldAuthor`, `TriggerFieldRate`, `TriggerFieldRateCount`, `ClassName`, `ClassFile`) VALUES 

+ 2 - 1
modules/boonex/english/data/langs/system/en.xml

@@ -1602,13 +1602,14 @@
         <string name="_cmt_txt_counter"><![CDATA[{0}]]></string>
         <string name="_cmt_txt_counter"><![CDATA[{0}]]></string>
 	<string name="_cmt_txt_counter_empty"><![CDATA[Comment]]></string>
 	<string name="_cmt_txt_counter_empty"><![CDATA[Comment]]></string>
         <string name="_cmt_txt_min_form_placeholder"><![CDATA[{0}, leave your comment here.]]></string>
         <string name="_cmt_txt_min_form_placeholder"><![CDATA[{0}, leave your comment here.]]></string>
-        <string name="_cmt_rvw_block_rating_title"><![CDATA[Rating]]></string>
+        <string name="_cmt_rvw_block_rating_title"><![CDATA[Reviews Rating]]></string>
         <string name="_cmt_rvw_block_reviews_title"><![CDATA[Reviews ({0})]]></string>
         <string name="_cmt_rvw_block_reviews_title"><![CDATA[Reviews ({0})]]></string>
         <string name="_cmt_rvw_txt_sample_comment_single"><![CDATA[review]]></string>
         <string name="_cmt_rvw_txt_sample_comment_single"><![CDATA[review]]></string>
         <string name="_cmt_rvw_txt_sample_reaction_single"><![CDATA['{0}' reaction to review]]></string>
         <string name="_cmt_rvw_txt_sample_reaction_single"><![CDATA['{0}' reaction to review]]></string>
         <string name="_cmt_rvw_txt_sample_score_up_single"><![CDATA[score up vote to review]]></string>
         <string name="_cmt_rvw_txt_sample_score_up_single"><![CDATA[score up vote to review]]></string>
         <string name="_cmt_rvw_txt_sample_score_down_single"><![CDATA[score down vote to review]]></string>
         <string name="_cmt_rvw_txt_sample_score_down_single"><![CDATA[score down vote to review]]></string>
         <string name="_cmt_rvw_txt_sample_vote_single"><![CDATA[vote to review]]></string>
         <string name="_cmt_rvw_txt_sample_vote_single"><![CDATA[vote to review]]></string>
+        <string name="_cmt_rvw_txt_empty"><![CDATA[No reviews yet]]></string>
         <string name="_copyright"><![CDATA[&copy; {0} Company]]></string>
         <string name="_copyright"><![CDATA[&copy; {0} Company]]></string>
 	<string name="_delete"><![CDATA[delete]]></string>
 	<string name="_delete"><![CDATA[delete]]></string>
 	<string name="_error occured"><![CDATA[Error occurred]]></string>
 	<string name="_error occured"><![CDATA[Error occurred]]></string>

+ 2 - 2
modules/boonex/forum/classes/BxForumCmts.php

@@ -47,13 +47,13 @@ class BxForumCmts extends BxTemplCmts
         BxDolTranscoderImage::cleanupObjectsArray($aTranscoders);
         BxDolTranscoderImage::cleanupObjectsArray($aTranscoders);
     }
     }
 
 
-	public function isPostReplyAllowed($isPerformAction = false)
+	public function isPostAllowed($isPerformAction = false)
     {
     {
     	$aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_iId);
     	$aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_iId);
         if(!$aContentInfo || (int)$aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_LOCK']] == 1)
         if(!$aContentInfo || (int)$aContentInfo[$this->_oModule->_oConfig->CNF['FIELD_LOCK']] == 1)
             return false;
             return false;
 
 
-    	return parent::isPostReplyAllowed($isPerformAction);
+    	return parent::isPostAllowed($isPerformAction);
     }
     }
 
 
     public function onPostAfter($iId)
     public function onPostAfter($iId)

+ 1 - 1
modules/boonex/lucid/data/template/system/comment.html

@@ -13,7 +13,7 @@
             </div>
             </div>
             <div class="__style_prefix__-cont bx-def-margin-sec-topbottom">
             <div class="__style_prefix__-cont bx-def-margin-sec-topbottom">
                 <div class="__style_prefix__-cont-cnt">
                 <div class="__style_prefix__-cont-cnt">
-                    <div class="__style_prefix__-body">__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more></div>
+                    <div class="__style_prefix__-body bx-def-margin-sec-top">__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more></div>
                     <bx_if:show_attached>
                     <bx_if:show_attached>
                         <div class="__style_prefix__-attached bx-def-margin-thd-leftright-neg bx-clearfix">__attached__</div>
                         <div class="__style_prefix__-attached bx-def-margin-thd-leftright-neg bx-clearfix">__attached__</div>
                     </bx_if:show_attached>
                     </bx_if:show_attached>

+ 1 - 2
modules/boonex/lucid/data/template/system/css/cmts.css

@@ -27,8 +27,7 @@ div.cmts li.cmt div.cmt-cnt div.cmt-head .cmt-meta-ago a {
 	color: #cccccc;
 	color: #cccccc;
 }
 }
 
 
-div.cmts li.cmt div.cmt-cnt div.cmt-cont,
-div.cmts li.cmt div.cmt-cnt div.cmt-cont p {
+div.cmts li.cmt div.cmt-cnt div.cmt-cont {
 	margin-top: 0.5rem;
 	margin-top: 0.5rem;
 	margin-bottom: 0.5rem;
 	margin-bottom: 0.5rem;
 }
 }

+ 4 - 4
modules/boonex/market/classes/BxMarketCmts.php

@@ -24,15 +24,15 @@ class BxMarketCmts extends BxTemplCmts
         $this->_aT['block_comments_title'] = '_bx_market_page_block_title_entry_comments_n';
         $this->_aT['block_comments_title'] = '_bx_market_page_block_title_entry_comments_n';
     }
     }
 
 
-    public function isPostReplyAllowed ($isPerformAction = false)
+    public function isPostAllowed ($isPerformAction = false)
     {
     {
     	$CNF = &$this->_oModule->_oConfig->CNF;
     	$CNF = &$this->_oModule->_oConfig->CNF;
 
 
     	$oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_COMMENT']);
     	$oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_COMMENT']);
-		if($oPrivacy && !$oPrivacy->check($this->_iId))
-			return false;
+        if($oPrivacy && !$oPrivacy->check($this->_iId))
+            return false;
 
 
-		return parent::isPostReplyAllowed($isPerformAction);
+        return parent::isPostAllowed($isPerformAction);
     }
     }
 }
 }
 
 

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

@@ -1602,13 +1602,14 @@
         <string name="_cmt_txt_counter"><![CDATA[{0}]]></string>
         <string name="_cmt_txt_counter"><![CDATA[{0}]]></string>
 	<string name="_cmt_txt_counter_empty"><![CDATA[Комментировать]]></string>
 	<string name="_cmt_txt_counter_empty"><![CDATA[Комментировать]]></string>
         <string name="_cmt_txt_min_form_placeholder"><![CDATA[{0}, здесь Вы можете оставить комментарий.]]></string>
         <string name="_cmt_txt_min_form_placeholder"><![CDATA[{0}, здесь Вы можете оставить комментарий.]]></string>
-        <string name="_cmt_rvw_block_rating_title"><![CDATA[Оценка]]></string>
+        <string name="_cmt_rvw_block_rating_title"><![CDATA[Оценка по обзорам]]></string>
         <string name="_cmt_rvw_block_reviews_title"><![CDATA[Обзоры ({0})]]></string>
         <string name="_cmt_rvw_block_reviews_title"><![CDATA[Обзоры ({0})]]></string>
         <string name="_cmt_rvw_txt_sample_comment_single"><![CDATA[обзор]]></string>
         <string name="_cmt_rvw_txt_sample_comment_single"><![CDATA[обзор]]></string>
         <string name="_cmt_rvw_txt_sample_reaction_single"><![CDATA[реакция '{0}' к обзору]]></string>
         <string name="_cmt_rvw_txt_sample_reaction_single"><![CDATA[реакция '{0}' к обзору]]></string>
         <string name="_cmt_rvw_txt_sample_score_up_single"><![CDATA[голос за обзор]]></string>
         <string name="_cmt_rvw_txt_sample_score_up_single"><![CDATA[голос за обзор]]></string>
         <string name="_cmt_rvw_txt_sample_score_down_single"><![CDATA[голос против обзора]]></string>
         <string name="_cmt_rvw_txt_sample_score_down_single"><![CDATA[голос против обзора]]></string>
         <string name="_cmt_rvw_txt_sample_vote_single"><![CDATA[голос за обзор]]></string>
         <string name="_cmt_rvw_txt_sample_vote_single"><![CDATA[голос за обзор]]></string>
+        <string name="_cmt_rvw_txt_empty"><![CDATA[Нет обзоров]]></string>
 	<string name="_copyright"><![CDATA[&copy; {0} Компания]]></string>
 	<string name="_copyright"><![CDATA[&copy; {0} Компания]]></string>
 	<string name="_delete"><![CDATA[удалить]]></string>
 	<string name="_delete"><![CDATA[удалить]]></string>
 	<string name="_error occured"><![CDATA[Произошла ошибка]]></string>
 	<string name="_error occured"><![CDATA[Произошла ошибка]]></string>

+ 1 - 1
template/comment.html

@@ -14,7 +14,7 @@
             </div>
             </div>
             <div class="__style_prefix__-cont bx-def-margin-sec-topbottom">
             <div class="__style_prefix__-cont bx-def-margin-sec-topbottom">
                 <div class="__style_prefix__-cont-cnt">
                 <div class="__style_prefix__-cont-cnt">
-                    <div class="__style_prefix__-body">__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more></div>
+                    <div class="__style_prefix__-body bx-def-margin-sec-top">__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more></div>
                     <bx_if:show_attached>
                     <bx_if:show_attached>
                         <div class="__style_prefix__-attached bx-def-margin-thd-leftright-neg bx-clearfix">__attached__</div>
                         <div class="__style_prefix__-attached bx-def-margin-thd-leftright-neg bx-clearfix">__attached__</div>
                     </bx_if:show_attached>
                     </bx_if:show_attached>

+ 8 - 2
template/css/cmts.css

@@ -145,6 +145,10 @@
         padding: 0px 5px;
         padding: 0px 5px;
         padding: 0px 0.3rem;
         padding: 0px 0.3rem;
     }
     }
+    div.cmt-cont .cmt-body p:first-child {
+        margin-top: 0;
+        margin-bottom: 0;
+    }
     div.cmt-cont .cmt-body img {
     div.cmt-cont .cmt-body img {
         max-width: 100%;
         max-width: 100%;
     	height: auto;
     	height: auto;
@@ -417,8 +421,10 @@ div.cmt-mood-buttons i.cmt-mood-star {
 }
 }
 
 
 /*--- Rating Block Styles ---*/
 /*--- Rating Block Styles ---*/
-.cmts-box-rating div.cmt-mood i.cmt-mood-star {
+.cmts-box-rating div.cmt-mood i.cmt-mood-star,
+.cmt-rating-element div.cmt-mood i.cmt-mood-star,
+.cmt-rating-element div.cmt-mood a.cmt-mood-button {
     height: 24px;
     height: 24px;
     width: 24px;
     width: 24px;
     font-size: 20px;
     font-size: 20px;
-}
+}

+ 4 - 2
template/review.html

@@ -14,8 +14,10 @@
             </div>
             </div>
             <div class="__style_prefix__-cont bx-def-margin-sec-topbottom">
             <div class="__style_prefix__-cont bx-def-margin-sec-topbottom">
                 <div class="__style_prefix__-cont-cnt">
                 <div class="__style_prefix__-cont-cnt">
-                    <div class="__style_prefix__-body">__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more></div>
-                    <div class="__style_prefix__-mood">__mood__</div>
+                    <bx_if:show_mood>
+                        <div class="__style_prefix__-mood">__mood__</div>
+                    </bx_if:show_mood>
+                    <div class="__style_prefix__-body bx-def-margin-sec-top">__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more></div>
                     <bx_if:show_attached>
                     <bx_if:show_attached>
                         <div class="__style_prefix__-attached bx-def-margin-thd-leftright-neg bx-clearfix">__attached__</div>
                         <div class="__style_prefix__-attached bx-def-margin-thd-leftright-neg bx-clearfix">__attached__</div>
                     </bx_if:show_attached>
                     </bx_if:show_attached>

+ 17 - 13
template/scripts/BxBaseCmts.php

@@ -371,9 +371,6 @@ class BxBaseCmts extends BxDolCmts
 
 
     function getFormBoxPost($aBp = array(), $aDp = array())
     function getFormBoxPost($aBp = array(), $aDp = array())
     {
     {
-        if(!$this->isPostReplyAllowed())
-            return '';
-
         return $this->_getFormBox(BX_CMT_ACTION_POST, $aBp, $aDp);
         return $this->_getFormBox(BX_CMT_ACTION_POST, $aBp, $aDp);
     }
     }
 
 
@@ -518,7 +515,7 @@ class BxBaseCmts extends BxDolCmts
         $iCount = $this->getCommentsCountAll();
         $iCount = $this->getCommentsCountAll();
         $bCount = (int)$iCount != 0;
         $bCount = (int)$iCount != 0;
 
 
-        $isAllowedComment = $this->isPostReplyAllowed();
+        $isAllowedComment = $this->isPostAllowed();
 
 
         //--- Do Comment
         //--- Do Comment
         $bTmplVarsDoComment = $this->_isShowDoComment($aParams, $isAllowedComment, $bCount);
         $bTmplVarsDoComment = $this->_isShowDoComment($aParams, $isAllowedComment, $bCount);
@@ -787,6 +784,8 @@ class BxBaseCmts extends BxDolCmts
 
 
         $sMethod = '_getForm' . ucfirst($sType);
         $sMethod = '_getForm' . ucfirst($sType);
         $aForm = $this->$sMethod($iCmtParentId, $aDp);
         $aForm = $this->$sMethod($iCmtParentId, $aDp);
+        if(empty($aForm['form']))
+            return '';
 
 
         return $this->_oTemplate->parseHtmlByName('comment_reply_box.html', array(
         return $this->_oTemplate->parseHtmlByName('comment_reply_box.html', array(
             'js_object' => $this->_sJsObjName,
             'js_object' => $this->_sJsObjName,
@@ -804,12 +803,16 @@ class BxBaseCmts extends BxDolCmts
 
 
     protected function _getFormPost($iCmtParentId = 0, $aDp = array())
     protected function _getFormPost($iCmtParentId = 0, $aDp = array())
     {
     {
+        $bCmtParentId = !empty($iCmtParentId);
+        if((!$bCmtParentId && !$this->isPostAllowed()) || ($bCmtParentId && !$this->isReplyAllowed($iCmtParentId)))
+            return array('msg' => _t('_Access denied'));
+
         $bDynamic = isset($aDp['dynamic_mode']) && (bool)$aDp['dynamic_mode'];
         $bDynamic = isset($aDp['dynamic_mode']) && (bool)$aDp['dynamic_mode'];
 
 
         $oForm = $this->_getForm(BX_CMT_ACTION_POST, $iCmtParentId);
         $oForm = $this->_getForm(BX_CMT_ACTION_POST, $iCmtParentId);
         $oForm->aInputs['cmt_parent_id']['value'] = $iCmtParentId;
         $oForm->aInputs['cmt_parent_id']['value'] = $iCmtParentId;
-        $oForm->initChecker();
 
 
+        $oForm->initChecker();
         if($oForm->isSubmittedAndValid()) {
         if($oForm->isSubmittedAndValid()) {
             $iCmtAuthorId = $this->_getAuthorId();
             $iCmtAuthorId = $this->_getAuthorId();
             $iCmtParentId = $oForm->getCleanValue('cmt_parent_id');
             $iCmtParentId = $oForm->getCleanValue('cmt_parent_id');
@@ -848,14 +851,16 @@ class BxBaseCmts extends BxDolCmts
 
 
                 $this->_triggerComment();
                 $this->_triggerComment();
 
 
-                $this->isPostReplyAllowed(true);
+                if($bCmtParentId)
+                    $this->isReplyAllowed($iCmtParentId, true);
+                else
+                    $this->isPostAllowed(true);
 
 
                 if($this->_sMetatagsObj && ($oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj)) !== false)
                 if($this->_sMetatagsObj && ($oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj)) !== false)
                     $oMetatags->metaAdd($iCmtUniqId, $sCmtText);
                     $oMetatags->metaAdd($iCmtUniqId, $sCmtText);
 
 
-                $this->onPostAfter($iCmtId);
-
-                return array('id' => $iCmtId, 'parent_id' => $iCmtParentId);
+                if(($mixedResult = $this->onPostAfter($iCmtId)) !== false)
+                    return $mixedResult;
             }
             }
 
 
             return array('msg' => _t('_cmt_err_cannot_perform_action'));
             return array('msg' => _t('_cmt_err_cannot_perform_action'));
@@ -868,7 +873,7 @@ class BxBaseCmts extends BxDolCmts
     {
     {
         $bDynamic = isset($aDp['dynamic_mode']) && (bool)$aDp['dynamic_mode'];
         $bDynamic = isset($aDp['dynamic_mode']) && (bool)$aDp['dynamic_mode'];
 
 
-        $aCmt = $this->_oQuery->getCommentSimple ((int)$this->getId(), $iCmtId);
+        $aCmt = $this->getCommentSimple($iCmtId);
         if(!$aCmt)
         if(!$aCmt)
             return array('msg' => _t('_No such comment'));
             return array('msg' => _t('_No such comment'));
 
 
@@ -890,9 +895,8 @@ class BxBaseCmts extends BxDolCmts
                 if($this->_sMetatagsObj && ($oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj)) !== false)
                 if($this->_sMetatagsObj && ($oMetatags = BxDolMetatags::getObjectInstance($this->_sMetatagsObj)) !== false)
                     $oMetatags->metaAdd($iCmtUniqId, $sCmtText);
                     $oMetatags->metaAdd($iCmtUniqId, $sCmtText);
 
 
-                $this->onEditAfter($iCmtId);
-
-                return array('id' => $iCmtId, 'text' => $this->_prepareTextForOutput($sCmtText, $iCmtId));
+                if(($mixedResult = $this->onEditAfter($iCmtId)) !== false)
+                    return $mixedResult;
             }
             }
 
 
             return array('msg' => _t('_cmt_err_cannot_perform_action'));
             return array('msg' => _t('_cmt_err_cannot_perform_action'));

+ 3 - 1
template/scripts/BxBaseCmtsMenuActions.php

@@ -110,7 +110,9 @@ class BxBaseCmtsMenuActions extends BxTemplMenuCustom
         $aCheckFuncParams = array();
         $aCheckFuncParams = array();
         switch ($a['name']) {
         switch ($a['name']) {
             case 'item-reply':
             case 'item-reply':
-                $sCheckFuncName = 'isPostReplyAllowed';
+                $sCheckFuncName = 'isReplyAllowed';
+                if(!empty($this->_aCmt))
+                    $aCheckFuncParams = array($this->_aCmt);
                 break;
                 break;
 
 
             case 'item-vote':
             case 'item-vote':

+ 53 - 16
template/scripts/BxBaseCmtsReviews.php

@@ -31,8 +31,15 @@ class BxBaseCmtsReviews extends BxDolCmtsReviews
         if(empty($sResult))
         if(empty($sResult))
             return $sResult;
             return $sResult;
 
 
+        $sMood = $this->_getMood($mixedCmt, $aDp);
         return $this->_oTemplate->parseHtmlByContent($sResult, array(
         return $this->_oTemplate->parseHtmlByContent($sResult, array(
-            'mood' => $this->_getMood($mixedCmt, $aDp)
+            'bx_if:show_mood' => array(
+                'condition' => !empty($sMood),
+                'content' => array(
+                    'style_prefix' => $this->_sStylePrefix,
+                    'mood' => $sMood
+                )
+            )
         ));
         ));
     }
     }
     
     
@@ -46,32 +53,62 @@ class BxBaseCmtsReviews extends BxDolCmtsReviews
         $this->_getParams($aBp, $aDp);
         $this->_getParams($aBp, $aDp);
 
 
         $iId = $this->getId();
         $iId = $this->getId();
+        $aStats = $this->_oQuery->getReviewsStats($iId);
 
 
-        $sCaption = _t($this->_aT['block_rating_title']);
-        $sContent = $this->_oTemplate->parseHtmlByName('reviews_rating_block.html', array(
-            'style_prefix' => $this->_sStylePrefix,
-            'system' => $this->_sSystem,
-            'id' => $iId,
-            'content' => $this->_oTemplate->parseHtmlByName('review_mood_legend.html', array_merge(array(
+        if(!empty($aStats) && is_array($aStats) && (int)$aStats['count'] > 0)
+            $sContent = $this->_oTemplate->parseHtmlByName('reviews_rating_block.html', array(
                 'style_prefix' => $this->_sStylePrefix,
                 'style_prefix' => $this->_sStylePrefix,
-                'html_id' => $this->getRatingLegendId(),
-                'value' => $this->_oQuery->getReviewsAvg($iId),
-                'bx_if:show_init' => array(
-                    'condition' => false,
-                    'content' => array()
-                )
-            ), $this->_getTmplVarsStars())),
-            'script' => $this->getJsScript($aBp, $aDp)
-        ));
+                'system' => $this->_sSystem,
+                'id' => $iId,
+                'content' => $this->_oTemplate->parseHtmlByName('review_mood_legend.html', array_merge(array(
+                    'style_prefix' => $this->_sStylePrefix,
+                    'html_id' => $this->getRatingLegendId(),
+                    'value' => (float)$aStats['avg'],
+                    'bx_if:show_init' => array(
+                        'condition' => false,
+                        'content' => array()
+                    )
+                ), $this->_getTmplVarsStars())),
+                'script' => $this->getJsScript($aBp, $aDp)
+            ));
+        else
+            $sContent = MsgBox(_t('_cmt_rvw_txt_empty'));
 
 
+        $sCaption = _t($this->_aT['block_rating_title']);
         return $aDp['in_designbox'] ? DesignBoxContent($sCaption, $sContent) : array(
         return $aDp['in_designbox'] ? DesignBoxContent($sCaption, $sContent) : array(
             'title' => $sCaption,
             'title' => $sCaption,
             'content' => $sContent
             'content' => $sContent
         );
         );
     }
     }
 
 
+    protected function _getForm($sAction, $iId)
+    {
+        $oForm = parent::_getForm($sAction, $iId);
+        
+        switch($sAction) {
+            case BX_CMT_ACTION_POST:
+                if(!empty($iId))
+                    unset($oForm->aInputs['cmt_mood']);
+                break;
+
+            case BX_CMT_ACTION_EDIT:
+                $aCmt = $this->getCommentSimple($iId);
+                if(!empty($aCmt['cmt_parent_id']))
+                    unset($oForm->aInputs['cmt_mood']);
+                break;
+        }
+
+        return $oForm;
+    }
+
     protected function _getMood(&$aCmt, $aDp = array())
     protected function _getMood(&$aCmt, $aDp = array())
     {
     {
+        if(!is_array($aCmt))
+            $aCmt = $this->getCommentSimple((int)$aCmt);
+
+        if((int)$aCmt['cmt_parent_id'] > 0)
+            return '';
+
         $sHtmlId = $this->getMoodLegendId($aCmt['cmt_id']);
         $sHtmlId = $this->getMoodLegendId($aCmt['cmt_id']);
         return $this->_oTemplate->parseHtmlByName('review_mood_legend.html', array_merge(array(
         return $this->_oTemplate->parseHtmlByName('review_mood_legend.html', array_merge(array(
             'style_prefix' => $this->_sStylePrefix,
             'style_prefix' => $this->_sStylePrefix,