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

#1 - comments browsing and layout

AntonLV 13 жил өмнө
parent
commit
63683ecb3d

+ 89 - 10
inc/classes/BxDolCmts.php

@@ -16,6 +16,15 @@ define('BX_CMT_DISPLAY_THREADED', 'threaded');
 
 
 define('BX_CMT_BROWSE_HEAD', 'head');
 define('BX_CMT_BROWSE_HEAD', 'head');
 define('BX_CMT_BROWSE_TAIL', 'tail');
 define('BX_CMT_BROWSE_TAIL', 'tail');
+define('BX_CMT_BROWSE_POPULAR', 'popular');
+define('BX_CMT_BROWSE_CONNECTION', 'connection');
+
+define('BX_CMT_ORDER_BY_DATE', 'date');
+define('BX_CMT_ORDER_BY_POPULAR', 'popular');
+define('BX_CMT_ORDER_BY_CONNECTION', 'connection');
+
+define('BX_CMT_ORDER_WAY_ASC', 'asc');
+define('BX_CMT_ORDER_WAY_DESC', 'desc');
 
 
 define('BX_CMT_PFP_TOP', 'top');
 define('BX_CMT_PFP_TOP', 'top');
 define('BX_CMT_PFP_BOTTOM', 'bottom');
 define('BX_CMT_PFP_BOTTOM', 'bottom');
@@ -129,7 +138,7 @@ class BxDolCmts extends BxDol
     var $_bDpOpened = false; ///< applied for Threaded comments only
     var $_bDpOpened = false; ///< applied for Threaded comments only
 
 
     var $_sBrowseType = '';
     var $_sBrowseType = '';
-    var $_sOrder = '';
+    var $_aOrder = array();
 
 
     /**
     /**
      * Constructor
      * Constructor
@@ -155,12 +164,15 @@ class BxDolCmts extends BxDol
             'CmtText' => array ('reg' => '^.{' . $iCmtTextMin . ',' . $iCmtTextMax . '}$', 'msg' => _t('_Please enter ' . $iCmtTextMin . '-' . $iCmtTextMax . ' characters'))
             'CmtText' => array ('reg' => '^.{' . $iCmtTextMin . ',' . $iCmtTextMax . '}$', 'msg' => _t('_Please enter ' . $iCmtTextMin . '-' . $iCmtTextMax . ' characters'))
         );
         );
 
 
-        $this->_iDpMaxLevel = 3;//(int)$this->_aSystem['number_of_levels'];
+        $this->_iDpMaxLevel = (int)$this->_aSystem['number_of_levels'];
         $this->_sDisplayType = $this->_iDpMaxLevel == 0 ? BX_CMT_DISPLAY_FLAT : BX_CMT_DISPLAY_THREADED;
         $this->_sDisplayType = $this->_iDpMaxLevel == 0 ? BX_CMT_DISPLAY_FLAT : BX_CMT_DISPLAY_THREADED;
         $this->_bDpOpened = true;
         $this->_bDpOpened = true;
 
 
         $this->_sBrowseType = $this->_aSystem['browse_type'];
         $this->_sBrowseType = $this->_aSystem['browse_type'];
-        $this->_sOrder = 'asc';
+        $this->_aOrder = array(
+        	'by' => BX_CMT_ORDER_BY_DATE, 
+        	'way' => BX_CMT_ORDER_WAY_ASC
+        );
 
 
         $this->_oQuery = new BxDolCmtsQuery($this->_aSystem);
         $this->_oQuery = new BxDolCmtsQuery($this->_aSystem);
         $this->_sHomeUrl = BX_DOL_URL_ROOT . trim($_SERVER['REQUEST_URI'], '/');
         $this->_sHomeUrl = BX_DOL_URL_ROOT . trim($_SERVER['REQUEST_URI'], '/');
@@ -170,10 +182,9 @@ class BxDolCmts extends BxDol
             $this->init($iId);
             $this->init($iId);
     }
     }
 
 
-    function & getSystems ()
+    function &getSystems ()
     {
     {
-        if (!isset($GLOBALS['bx_dol_cmts_systems']))
-        {
+        if (!isset($GLOBALS['bx_dol_cmts_systems'])) {
             $GLOBALS['bx_dol_cmts_systems'] = BxDolDb::getInstance()->fromCache('sys_objects_cmts', 'getAllWithKey', '
             $GLOBALS['bx_dol_cmts_systems'] = BxDolDb::getInstance()->fromCache('sys_objects_cmts', 'getAllWithKey', '
                 SELECT
                 SELECT
                     `ID` as `system_id`,
                     `ID` as `system_id`,
@@ -260,6 +271,10 @@ class BxDolCmts extends BxDol
         $this->_iId = $iId;
         $this->_iId = $iId;
     }
     }
 
 
+    function setHomeUrl($sUrl)
+    {
+    	$this->_sHomeUrl = $sUrl; 
+    }
 
 
 
 
     function isValidSystem ($sSystem)
     function isValidSystem ($sSystem)
@@ -306,9 +321,9 @@ class BxDolCmts extends BxDol
     /** comments functions
     /** comments functions
      *********************************************/
      *********************************************/
 
 
-    function getCommentsArray ($iCmtParentId, $sCmtOrder, $iStart = 0, $iCount = -1)
+    function getCommentsArray ($iParentId, $aOrder, $iStart = 0, $iCount = -1)
     {
     {
-        return $this->_oQuery->getComments ($this->getId(), $iCmtParentId, $this->_getAuthorId(), $sCmtOrder, $iStart, $iCount);
+        return $this->_oQuery->getComments ($this->getId(), $iParentId, $this->_getAuthorId(), $aOrder, $iStart, $iCount);
     }
     }
 
 
     function getCommentRow ($iCmtId)
     function getCommentRow ($iCmtId)
@@ -455,9 +470,10 @@ class BxDolCmts extends BxDol
            return '';
            return '';
 
 
         $iCmtId = bx_process_input($_REQUEST['Cmt'], BX_DATA_INT);
         $iCmtId = bx_process_input($_REQUEST['Cmt'], BX_DATA_INT);
+        $sCmtBrowse = isset($_REQUEST['CmtBrowse']) ? bx_process_input($_REQUEST['CmtBrowse'], BX_DATA_TEXT) : '';
         $sCmtDisplay = isset($_REQUEST['CmtDisplay']) ? bx_process_input($_REQUEST['CmtDisplay'], BX_DATA_TEXT) : '';
         $sCmtDisplay = isset($_REQUEST['CmtDisplay']) ? bx_process_input($_REQUEST['CmtDisplay'], BX_DATA_TEXT) : '';
 
 
-        return $this->getComment($iCmtId, array('type' => $sCmtDisplay));
+        return $this->getComment($iCmtId, array('type' => $sCmtBrowse), array('type' => $sCmtDisplay));
     }
     }
 
 
     function actionCmtPost ()
     function actionCmtPost ()
@@ -623,7 +639,7 @@ class BxDolCmts extends BxDol
 
 
     function _getAuthorId ()
     function _getAuthorId ()
     {
     {
-        return isMember() ? $_COOKIE['memberID'] : 0;
+        return isMember() ? bx_get_logged_profile_id() : 0;
     }
     }
 
 
     function _getAuthorPassword ()
     function _getAuthorPassword ()
@@ -636,6 +652,16 @@ class BxDolCmts extends BxDol
         return $_SERVER['REMOTE_ADDR'];
         return $_SERVER['REMOTE_ADDR'];
     }
     }
 
 
+	function _getAuthorInfo($iAuthorId = 0)
+    {
+		$oProfile = BxDolProfile::getInstance($iAuthorId);
+		return array(
+			$oProfile->getDisplayName(), 
+			$oProfile->getUrl(), 
+			$oProfile->getThumb()
+		);
+    }
+
     function _prepareTextForEdit ($s)
     function _prepareTextForEdit ($s)
     {
     {
         if ($this->isNl2br())
         if ($this->isNl2br())
@@ -653,6 +679,59 @@ class BxDolCmts extends BxDol
         return bx_process_input($s, $iDataAction);
         return bx_process_input($s, $iDataAction);
     }
     }
 
 
+	function _prepareParams(&$aBp, &$aDp)
+    {
+    	$aBp['type'] = isset($aBp['type']) && !empty($aBp['type']) ? $aBp['type'] : $this->_sBrowseType;
+    	$aBp['parent_id'] = isset($aBp['parent_id']) ? $aBp['parent_id'] : 0;
+    	$aBp['start'] = isset($aBp['start']) ? $aBp['start'] : -1;
+    	$aBp['per_view'] = isset($aBp['per_view']) ? $aBp['per_view'] : -1;
+    	$aBp['order']['by'] = isset($aBp['order_by']) ? $aBp['order_by'] : $this->_aOrder['by'];
+    	$aBp['order']['way'] = isset($aBp['order_way']) ? $aBp['order_way'] : $this->_aOrder['way'];
+
+    	$aDp['type'] = isset($aDp['type']) && !empty($aDp['type']) ? $aDp['type'] : $this->_sDisplayType;
+    	$aDp['opened'] = isset($aDp['opened']) ? $aDp['opened'] : $this->_bDpOpened;
+
+		switch($aDp['type']) {
+			case BX_CMT_DISPLAY_FLAT:
+				$aBp['parent_id'] = -1;
+				$aBp['per_view'] = $aBp['per_view'] != -1 ? $aBp['per_view'] : $this->getPerView(0);
+				break;
+
+			case BX_CMT_DISPLAY_THREADED:
+				$aBp['per_view'] = $aBp['per_view'] != -1 ? $aBp['per_view'] : $this->getPerView($aBp['parent_id']);
+				break;
+		}
+
+		switch ($aBp['type']) {
+			case BX_CMT_BROWSE_POPULAR:
+				$aBp['order'] = array(
+					'by' => BX_CMT_ORDER_BY_POPULAR,
+					'way' => BX_CMT_ORDER_WAY_DESC
+				);
+				break;
+
+			case BX_CMT_BROWSE_CONNECTION:
+				$aBp['order'] = array(
+					'by' => BX_CMT_ORDER_BY_CONNECTION,
+					'way' => BX_CMT_ORDER_WAY_DESC
+				);
+				break;
+		}
+
+		$aBp['count'] = $this->_oQuery->getCommentsCount($this->_iId, $aBp['parent_id']);
+		if($aBp['start'] != -1)
+			return;
+
+		$aBp['start'] = 0;
+		if($aBp['type'] == BX_CMT_BROWSE_TAIL) {
+			$aBp['start'] = $aBp['count'] - $aBp['per_view'];
+			if($aBp['start'] < 0) {
+    			$aBp['per_view'] += $aBp['start'];
+    			$aBp['start'] = 0;
+			}
+		}
+    }
+
     function _triggerComment()
     function _triggerComment()
     {
     {
         if (!$this->_aSystem['trigger_table'])
         if (!$this->_aSystem['trigger_table'])

+ 28 - 4
inc/classes/BxDolCmtsQuery.php

@@ -39,7 +39,7 @@ class BxDolCmtsQuery extends BxDolDb
 		return (int)$this->getOne($sQuery);
 		return (int)$this->getOne($sQuery);
 	}
 	}
 
 
-    function getComments ($iId, $iCmtParentId = 0, $iAuthorId = 0, $sCmtOrder = 'ASC', $iStart = 0, $iCount = -1)
+    function getComments ($iId, $iCmtParentId = 0, $iAuthorId = 0, $aOrder = array(), $iStart = 0, $iCount = -1)
     {
     {
         global $sHomeUrl;
         global $sHomeUrl;
         $iTimestamp = time();
         $iTimestamp = time();
@@ -48,13 +48,38 @@ class BxDolCmtsQuery extends BxDolDb
         $sJoin = "";
         $sJoin = "";
         if ($iAuthorId) {
         if ($iAuthorId) {
             $sFields = "`r`.`cmt_rate` AS `cmt_rated`,";
             $sFields = "`r`.`cmt_rate` AS `cmt_rated`,";
-            $sJoin = $this->prepare("LEFT JOIN `{$this->_sTableTrack}` AS `r` ON (`r`.`cmt_system_id` = ? AND `r`.`cmt_id` = `c`.`cmt_id` AND `r`.`cmt_rate_author_id` = ?)", $this->_aSystem['system_id'], $iAuthorId);
+            $sJoin = $this->prepare(" LEFT JOIN `{$this->_sTableTrack}` AS `r` ON (`r`.`cmt_system_id` = ? AND `r`.`cmt_id` = `c`.`cmt_id` AND `r`.`cmt_rate_author_id` = ?)", $this->_aSystem['system_id'], $iAuthorId);
         }
         }
 
 
         $sWhereParent = '';
         $sWhereParent = '';
         if((int)$iCmtParentId >= 0)
         if((int)$iCmtParentId >= 0)
         	$sWhereParent = $this->prepare(" AND `c`.`cmt_parent_id` = ?", $iCmtParentId);
         	$sWhereParent = $this->prepare(" AND `c`.`cmt_parent_id` = ?", $iCmtParentId);
 
 
+        $sOder = " ORDER BY `c`.`cmt_time` ASC";
+        if(isset($aOrder['by']) && isset($aOrder['way'])) {
+        	$aOrder['way'] = strtoupper(in_array($aOrder['way'], array(BX_CMT_ORDER_WAY_ASC, BX_CMT_ORDER_WAY_DESC)) ? $aOrder['way'] : BX_CMT_ORDER_WAY_ASC);
+
+        	switch($aOrder['by']) {
+        		case BX_CMT_ORDER_BY_DATE:
+        			$sOder = " ORDER BY `c`.`cmt_time` " . $aOrder['way'];
+        			break;
+
+        		case BX_CMT_ORDER_BY_POPULAR:
+        			$sOder = " ORDER BY `c`.`cmt_rate` " . $aOrder['way'];
+        			break;
+
+        		case BX_CMT_ORDER_BY_CONNECTION:
+        			$sFields .= " IF(NOT ISNULL(`tcc`.`id`), 1, 0) AS `cmt_author_contact`,";
+        			$sFields .= " IF(NOT ISNULL(`tcf`.`id`), 1, 0) AS `cmt_author_friend`,";
+
+        			$sJoin .= $this->prepare(" LEFT JOIN `sys_profiles_conn_contacts` AS `tcc` ON ((`c`.`cmt_author_id`=`tcc`.`initiator` AND `tcc`.`content`=?) OR (`c`.`cmt_author_id`=`tcc`.`content` AND `tcc`.`initiator`=?))", $iAuthorId, $iAuthorId);
+        			$sJoin .= $this->prepare(" LEFT JOIN `sys_profiles_conn_friends` AS `tcf` ON ((`c`.`cmt_author_id`=`tcf`.`initiator` AND `tcf`.`content`=?) OR (`c`.`cmt_author_id`=`tcf`.`content` AND `tcf`.`initiator`=?))", $iAuthorId, $iAuthorId);
+
+        			$sOder = " ORDER BY `cmt_author_friend` " . $aOrder['way'] . ",`cmt_author_contact` " . $aOrder['way'] . ",`c`.`cmt_time` ASC";
+        			break;
+	        }
+        }
+         
         $sLimit = $iCount != -1 ? $this->prepare(" LIMIT ?, ?", (int)$iStart, (int)$iCount) : '';
         $sLimit = $iCount != -1 ? $this->prepare(" LIMIT ?, ?", (int)$iStart, (int)$iCount) : '';
 
 
         $sQuery = $this->prepare("SELECT
         $sQuery = $this->prepare("SELECT
@@ -72,8 +97,7 @@ class BxDolCmtsQuery extends BxDolDb
                 (? - UNIX_TIMESTAMP(`c`.`cmt_time`)) AS `cmt_secs_ago`
                 (? - UNIX_TIMESTAMP(`c`.`cmt_time`)) AS `cmt_secs_ago`
             FROM `{$this->_sTable}` AS `c`
             FROM `{$this->_sTable}` AS `c`
             $sJoin
             $sJoin
-            WHERE `c`.`cmt_object_id` = ?" . $sWhereParent . "
-            ORDER BY `c`.`cmt_time` " . (strtoupper($sCmtOrder) == 'ASC' ? 'ASC' : 'DESC') . $sLimit, $iTimestamp, $iId);
+            WHERE `c`.`cmt_object_id` = ?" . $sWhereParent . $sOder . $sLimit, $iTimestamp, $iId);
 
 
         $a = $this->getAll($sQuery);
         $a = $this->getAll($sQuery);
 
 

+ 4 - 5
inc/js/classes/BxDolCmts.js

@@ -225,7 +225,7 @@ BxDolCmts.prototype.cmtMore = function(oLink, iCmtParentId, iStart, iPerView)
 {
 {
 	var $this = this;
 	var $this = this;
 	this._getCmts(oLink, iCmtParentId, iStart, iPerView, this._sBrowseType, this._sDisplayType, function(sListId, sContent) {
 	this._getCmts(oLink, iCmtParentId, iStart, iPerView, this._sBrowseType, this._sDisplayType, function(sListId, sContent) {
-		$this._cmtsReplace($(oLink).parents('.cmt-more'), sContent);
+		$this._cmtsReplace($(oLink).parents('li:first'), sContent);
 	});
 	});
 };
 };
 
 
@@ -391,6 +391,7 @@ BxDolCmts.prototype._getCmt = function (f, iCmtParentId, iCmtId)
     var oData = this._getDefaultActions();
     var oData = this._getDefaultActions();
     oData['action'] = 'CmtGet';
     oData['action'] = 'CmtGet';
     oData['Cmt'] = iCmtId;
     oData['Cmt'] = iCmtId;
+    oData['CmtBrowse'] = this._sBrowseType;
     oData['CmtDisplay'] = this._sDisplayType;
     oData['CmtDisplay'] = this._sDisplayType;
 
 
     var sParentId =  this._sRootId + ' #cmt' + iCmtParentId;
     var sParentId =  this._sRootId + ' #cmt' + iCmtParentId;
@@ -488,10 +489,8 @@ BxDolCmts.prototype._getDefaultActions = function() {
 };
 };
 
 
 BxDolCmts.prototype._loading = function(e, bShow) {
 BxDolCmts.prototype._loading = function(e, bShow) {
-    if(bShow && !$(e).parent().find('b').length)
-        $(e).parent().append(' <b>' + aDolLang['_sys_txt_cmt_loading'] + '</b>');
-    else if (!bShow && $(e).parent().find('b').length)
-    	$(e).parent().find('b').remove();
+	var oParent = $(e).length ? $(e).parents('.bx-db-content:first') : $('body'); 
+	bx_loading(oParent, bShow);
 };
 };
 
 
 BxDolCmts.prototype._error = function(e, bShow, s) {
 BxDolCmts.prototype._error = function(e, bShow, s) {

+ 1 - 1
inc/utils.inc.php

@@ -898,7 +898,7 @@ function bx_is_spam ($val, $isStripSlashes = BX_SLASHES_AUTO) {
     if (isAdmin())
     if (isAdmin())
         return false;
         return false;
 
 
-    if (bx_is_ip_whitelisted($sCurIP))
+    if (bx_is_ip_whitelisted())
         return false;
         return false;
 
 
     if (get_magic_quotes_gpc() && $isStripSlashes == BX_SLASHES_AUTO)
     if (get_magic_quotes_gpc() && $isStripSlashes == BX_SLASHES_AUTO)

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

@@ -1176,7 +1176,11 @@ Please click "Continue" below to navigate to the home page of the site.]]></stri
 	<string name="_Reply_to_this_comment"><![CDATA[Reply]]></string>
 	<string name="_Reply_to_this_comment"><![CDATA[Reply]]></string>
 	<string name="_Add Your Comment"><![CDATA[Comment]]></string>
 	<string name="_Add Your Comment"><![CDATA[Comment]]></string>
 	<string name="_Submit_Comment"><![CDATA[Post]]></string>
 	<string name="_Submit_Comment"><![CDATA[Post]]></string>
-	<string name="_load_more_comments"><![CDATA[Load More]]></string>
+	<string name="_load_more_comments_head"><![CDATA[See Newer Comments...]]></string>
+	<string name="_load_more_comments_tail"><![CDATA[See Older Comments...]]></string>
+	<string name="_load_more_comments_popular"><![CDATA[See More Comments...]]></string>
+	<string name="_load_more_comments_connection"><![CDATA[See More Comments...]]></string>
+	<string name="_cmt_track_replies"><![CDATA[track replies]]></string>
 	<string name="_in_reply_to"><![CDATA[in reply to]]></string>
 	<string name="_in_reply_to"><![CDATA[in reply to]]></string>
 	<string name="_Can not delete comments with replies"><![CDATA[Cannot delete comments with replies]]></string>
 	<string name="_Can not delete comments with replies"><![CDATA[Cannot delete comments with replies]]></string>
 	<string name="_Access denied"><![CDATA[Access denied]]></string>
 	<string name="_Access denied"><![CDATA[Access denied]]></string>

+ 1 - 1
modules/boonex/english/install/config.php

@@ -33,7 +33,7 @@ $aConfig = array(
     'update_url' => 'http://www.boonex.com/m/{uri}',
     'update_url' => 'http://www.boonex.com/m/{uri}',
 
 
     'compatible_with' => array(
     'compatible_with' => array(
-        '7.0.6'
+        '8.0.x'
     ),
     ),
 
 
     /**
     /**

+ 6 - 6
samples/comments.php

@@ -16,9 +16,9 @@
  * DB Queries.
  * DB Queries.
 
 
 INSERT INTO `sys_objects_cmts` (`ID`, `ObjectName`, `TableCmts`, `TableTrack`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Nl2br`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
 INSERT INTO `sys_objects_cmts` (`ID`, `ObjectName`, `TableCmts`, `TableTrack`, `CharsPostMin`, `CharsPostMax`, `CharsDisplayMax`, `Nl2br`, `PerView`, `PerViewReplies`, `BrowseType`, `IsBrowseSwitch`, `PostFormPosition`, `NumberOfLevels`, `IsDisplaySwitch`, `IsRatable`, `ViewingThreshold`, `IsOn`, `RootStylePrefix`, `TriggerTable`, `TriggerFieldId`, `TriggerFieldComments`, `ClassName`, `ClassFile`) VALUES
-(1, 'profile', 'sys_cmts_sample', 'sys_cmts_sample_track', 3, 2048, 100, 1, 5, 3, 'tail', 1, 'both', 1, 1, 1, -3, 1, 'cmt', '', '', '', '', '');
+(1, 'sample', 'sample_cmts', 'sample_cmts_track', 1, 5000, 1000, 1, 5, 3, 'tail', 1, 'bottom', 1, 1, 1, -3, 1, 'cmt', '', '', '', '', '');
 
 
-CREATE TABLE IF NOT EXISTS `sys_cmts_sample` (
+CREATE TABLE IF NOT EXISTS `sample_cmts` (
   `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
   `cmt_id` int(11) NOT NULL AUTO_INCREMENT,
   `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
   `cmt_parent_id` int(11) NOT NULL DEFAULT '0',
   `cmt_object_id` int(11) NOT NULL DEFAULT '0',
   `cmt_object_id` int(11) NOT NULL DEFAULT '0',
@@ -34,7 +34,7 @@ CREATE TABLE IF NOT EXISTS `sys_cmts_sample` (
   KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
   KEY `cmt_object_id` (`cmt_object_id`,`cmt_parent_id`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
 
 
-CREATE TABLE IF NOT EXISTS `sys_cmts_sample_track` (
+CREATE TABLE IF NOT EXISTS `sample_cmts_track` (
   `cmt_system_id` int(11) NOT NULL DEFAULT '0',
   `cmt_system_id` int(11) NOT NULL DEFAULT '0',
   `cmt_id` int(11) NOT NULL DEFAULT '0',
   `cmt_id` int(11) NOT NULL DEFAULT '0',
   `cmt_rate` tinyint(4) NOT NULL DEFAULT '0',
   `cmt_rate` tinyint(4) NOT NULL DEFAULT '0',
@@ -57,7 +57,7 @@ bx_import('BxTemplFunctions');
 
 
 $oTemplate = BxDolTemplate::getInstance();
 $oTemplate = BxDolTemplate::getInstance();
 $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
 $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
-$oTemplate->setPageHeader ("Comments");
+$oTemplate->setPageHeader ('Comments');
 $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
 $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
 $oTemplate->getPageCode();
 $oTemplate->getPageCode();
 
 
@@ -66,10 +66,10 @@ $oTemplate->getPageCode();
  * page code function
  * page code function
  */
  */
 function PageCompMainCode() {
 function PageCompMainCode() {
-	$iAccountId = getLoggedId();
+	$iObjectId = 1;
 
 
 	bx_import('BxTemplCmtsView');
 	bx_import('BxTemplCmtsView');
-	$oCmts = new BxTemplCmtsView('profile', (int)$iAccountId);
+	$oCmts = new BxTemplCmtsView('sample', $iObjectId);
 	if(!$oCmts->isEnabled())
 	if(!$oCmts->isEnabled())
 		return '';
 		return '';
 
 

+ 8 - 1
template/comment.html

@@ -3,7 +3,14 @@
 		<a name="__system____id__"></a>
 		<a name="__system____id__"></a>
 		<div class="bx-def-hr bx-def-margin-bottom"></div>
 		<div class="bx-def-hr bx-def-margin-bottom"></div>
 		<div class="__style_prefix__-cont">
 		<div class="__style_prefix__-cont">
-			<div class="__style_prefix__-icon">__author_icon__</div>
+			<div class="__style_prefix__-icon">
+				<bx_if:show_icon>
+					<img src="__author_icon__" />
+				</bx_if:show_icon>
+				<bx_if:show_icon_empty>
+					<i class="sys-icon user"></i>
+				</bx_if:show_icon_empty>
+			</div>
 			<div class="__style_prefix__-head">
 			<div class="__style_prefix__-head">
 				<span class="__style_prefix__-author">
 				<span class="__style_prefix__-author">
 					<bx_if:show_author_link><a href="__author_link__">__author_name__</a> </bx_if:show_author_link>
 					<bx_if:show_author_link><a href="__author_link__">__author_name__</a> </bx_if:show_author_link>

+ 8 - 8
template/comment_actions.html

@@ -1,22 +1,22 @@
 <div class="__style_prefix__-actions">
 <div class="__style_prefix__-actions">
-	<span class="bullet">&#183;</span><a class="bx-def-font-grayed" href="__view_link__">__ago__</a>
-	<span class="bullet">&#183;</span><span class="__style_prefix__-points bx-def-font-grayed">__points__</span>
+	<span class="bullet">&#183;</span><a class="__style_prefix__-ago" href="__view_link__">__ago__</a>
+	<span class="bullet">&#183;</span><span class="__style_prefix__-points">__points__</span>
 	<bx_if:show_rate>
 	<bx_if:show_rate>
-		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-vote bx-def-font-grayed" title="<bx_text:_Plus />" href="javascript:void(0)" onclick="__js_object__.cmtRate(this, __id__, 1)"><bx_text:_Plus /></a>
+		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-vote" title="<bx_text:_Plus />" href="javascript:void(0)" onclick="__js_object__.cmtRate(this, __id__, 1)"><bx_text:_Plus /></a>
 		<!--
 		<!--
-		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-vote bx-def-font-grayed" title="<bx_text:_Minus />" href="javascript:void(0)" onclick="__js_object__.cmtRate(this, __id__, -1)"><bx_text:_Minus /></a>
+		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-vote" title="<bx_text:_Minus />" href="javascript:void(0)" onclick="__js_object__.cmtRate(this, __id__, -1)"><bx_text:_Minus /></a>
 		-->
 		-->
 	</bx_if:show_rate>
 	</bx_if:show_rate>
 	<bx_if:show_reply>
 	<bx_if:show_reply>
-		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-reply bx-def-font-grayed" href="javascript:void(0)" onclick="__js_object__.toggleReply(this, __id__); return false;">__text__</a>
+		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-reply" href="javascript:void(0)" onclick="__js_object__.toggleReply(this, __id__); return false;">__text__</a>
 	</bx_if:show_reply>
 	</bx_if:show_reply>
 	<bx_if:show_replies>
 	<bx_if:show_replies>
-		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-replies bx-def-font-grayed" href="javascript:void(0)" onclick="__js_object__.toggleCmts(this, __id__); return false;">__text__</a>
+		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-replies" href="javascript:void(0)" onclick="__js_object__.toggleCmts(this, __id__); return false;">__text__</a>
 	</bx_if:show_replies>
 	</bx_if:show_replies>
 	<bx_if:show_edit>
 	<bx_if:show_edit>
-		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-manage-edit bx-def-font-grayed" title="<bx_text:_Edit />" href="javascript:void(0)" onclick="__js_object__.cmtEdit(this, __id__); return false;"><bx_text:_Edit /></a>
+		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-manage-edit" title="<bx_text:_Edit />" href="javascript:void(0)" onclick="__js_object__.cmtEdit(this, __id__); return false;"><bx_text:_Edit /></a>
 	</bx_if:show_edit>
 	</bx_if:show_edit>
 	<bx_if:show_delete>
 	<bx_if:show_delete>
-		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-manage-delete bx-def-font-grayed" title="<bx_text:_Delete />" href="javascript:void(0)" onclick="__js_object__.cmtRemove(this, __id__); return false;"><bx_text:_Delete /></a>
+		<span class="bullet">&#183;</span><a class="__style_prefix__-comment-manage-delete" title="<bx_text:_Delete />" href="javascript:void(0)" onclick="__js_object__.cmtRemove(this, __id__); return false;"><bx_text:_Delete /></a>
 	</bx_if:show_delete>
 	</bx_if:show_delete>
 </div>
 </div>

+ 3 - 4
template/comment_more.html

@@ -1,7 +1,6 @@
-<li class="__style_prefix__-more bx-def-margin-top">
+<li class="__style_prefix__-more<bx_if:is_root>-root</bx_if:is_root> bx-def-margin-top">
 	<div class="__style_prefix__-more-cont" style="margin-left:__margin__px;">
 	<div class="__style_prefix__-more-cont" style="margin-left:__margin__px;">
-		<a href="javascript:void(0)" onclick="javascript:__js_object__.cmtMore(this, __parent_id__, __start__, __per_view__)">
-			<bx_text:_load_more_comments />
-		</a>
+		<div class="__style_prefix__-more-line bx-def-hr"></div>
+		<a class="<bx_if:is_button>bx-btn</bx_if:is_button>" href="javascript:void(0)" onclick="javascript:__js_object__.cmtMore(this, __parent_id__, __start__, __per_view__)">__title__</a>
 	</div>
 	</div>
 </li>
 </li>

+ 8 - 1
template/comment_reply_box.html

@@ -1,5 +1,12 @@
 <div class="__style_prefix__-reply<bx_if:show_class> __class__</bx_if:show_class>" style="margin-left:__margin__px;">
 <div class="__style_prefix__-reply<bx_if:show_class> __class__</bx_if:show_class>" style="margin-left:__margin__px;">
-	<div class="__style_prefix__-icon">__author_icon__</div>
+	<div class="__style_prefix__-icon">
+		<bx_if:show_icon>
+			<img src="__author_icon__" />
+		</bx_if:show_icon>
+		<bx_if:show_icon_empty>
+			<i class="sys-icon user"></i>
+		</bx_if:show_icon_empty>
+	</div>
 	<div class="__style_prefix__-post-reply bx-def-margin-top">
 	<div class="__style_prefix__-post-reply bx-def-margin-top">
 	    __form__
 	    __form__
 	</div>
 	</div>

+ 0 - 8
template/comment_reply_form.html

@@ -1,8 +0,0 @@
-<form name="cmt-post-reply" onsubmit="__js_object__.__js_function__; return false;">
-	<input type="hidden" name="CmtParent" value="__parent_id__" />
-	<input type="hidden" name="CmtType" value="text" />
-	<div class="cmt-post-reply-text">
-		<textarea name="CmtText">__text__</textarea>
-	</div>
-	<div class="cmt-post-reply-post"><input type="submit" value="<bx_text:_Submit_Comment />" /></div>
-</form>

+ 2 - 4
template/comments_controls.html

@@ -1,12 +1,10 @@
-<div class="__style_prefix__-browse bx-def-margin-top-auto">
+<div class="__style_prefix__-browse bx-def-margin-top-auto bx-clearfix">
 	<div class="__style_prefix__-browse-left bx-def-font-h3">__comments_count__</div>
 	<div class="__style_prefix__-browse-left bx-def-font-h3">__comments_count__</div>
-	<div class="__style_prefix__-browse-right bx-def-font-small">
+	<div class="__style_prefix__-browse-right bx-def-font-small bx-clearfix">
 		__display_switcher__
 		__display_switcher__
 		<bx_if:is_divider>
 		<bx_if:is_divider>
 			<div class="__style_prefix__-browse-type-div">|</div>
 			<div class="__style_prefix__-browse-type-div">|</div>
 		</bx_if:is_divider>
 		</bx_if:is_divider>
 		__browse_switcher__
 		__browse_switcher__
-		<div class="bx-clear"></div>
 	</div>
 	</div>
-	<div class="bx-clear"></div>
 </div>
 </div>

+ 48 - 10
template/css/cmts.css

@@ -15,12 +15,6 @@
     li.cmt:first-child {
     li.cmt:first-child {
 		margin-top: 0px;
 		margin-top: 0px;
     }
     }
-    li.cmt-more {}
-    div.cmt-more-cont {
-		padding: 5px 0px;
-    	background-color: #ededed;
-    	text-indent: 5px;
-    }
     li.cmt-err {
     li.cmt-err {
         color: red;
         color: red;
     }
     }
@@ -42,6 +36,37 @@
        color: #333333;
        color: #333333;
     }
     }
 
 
+	/*--- More ---*/
+    li.cmt-more {}
+	li.cmt-more-root {}
+	div.cmt-more-cont {}
+	div.cmt-more-line {}
+
+	li.cmt-more div.cmt-more-cont {
+		font-weight: bold;
+	}
+	li.cmt-more div.cmt-more-line {
+		display: none;
+	}
+
+	
+    li.cmt-more-root div.cmt-more-cont {
+    	position: relative;
+		text-align: center;
+    }
+    li.cmt-more-root div.cmt-more-line {
+    	position: absolute;
+    	top: 50%;
+    	width: 100%;
+		border-width: 4px;
+    	borded-bottom: none;
+    }
+    li.cmt-more-root .bx-btn {
+    	position: relative;
+		float: none;
+    	display: inline-block;
+    }    
+
     /*--- Comment ---*/
     /*--- Comment ---*/
     div.cmt-cont {
     div.cmt-cont {
         position: relative;
         position: relative;
@@ -57,7 +82,10 @@
     	left: 0px;
     	left: 0px;
     	width: 64px;
     	width: 64px;
     	height: 64px;
     	height: 64px;
-    	background-color: #cccccc;
+    	text-align: center;
+    }
+    div.cmt-icon .sys-icon {
+		font-size: 64px;
     }
     }
     span.cmt-author {
     span.cmt-author {
 		font-weight: bold;
 		font-weight: bold;
@@ -115,11 +143,20 @@
 	div.cmt-reply-bottom {
 	div.cmt-reply-bottom {
 		margin-top: 40px;
 		margin-top: 40px;
     }
     }
-	div.cmt-reply-expanded {}
-    div.cmt-post-reply {
+	div.cmt-post-reply {
         position: relative;
         position: relative;
     	padding-left: 84px;
     	padding-left: 84px;
     }
     }
+    form.cmt-post-reply .bx-form-input-textarea {
+		height: 64px;
+    }
+    form.cmt-post-reply .bx-form-input-submit {
+		margin-right: 30px;
+    }
+    
+    /*
+	div.cmt-reply-expanded {}
+    
     div.cmt-post-reply form {
     div.cmt-post-reply form {
         display: block;
         display: block;
     }
     }
@@ -146,4 +183,5 @@
     a.cmt-comment-manage-edit,
     a.cmt-comment-manage-edit,
     a.cmt-comment-manage-delete,
     a.cmt-comment-manage-delete,
     a.cmt-comment-replies {
     a.cmt-comment-replies {
-    }
+    }
+    */

+ 1 - 2
template/menu_interactive.html

@@ -1,4 +1,4 @@
-<ul id="bx-menu-inter-__id__" class="bx-menu-inter">
+<ul id="bx-menu-inter-__id__" class="bx-menu-inter bx-clearfix">
 	<bx_repeat:menu_items>
 	<bx_repeat:menu_items>
 		<li class="bx-menu-inter-div"><span>&#183;</span></li>
 		<li class="bx-menu-inter-div"><span>&#183;</span></li>
 	    <li id="__id__-act" class="bx-menu-inter-act __class_wrp_act__">
 	    <li id="__id__-act" class="bx-menu-inter-act __class_wrp_act__">
@@ -8,7 +8,6 @@
 	        <a id="__id__" class="__class__" href="__link__" target="__target__" onclick="__onclick__">__title__</a>
 	        <a id="__id__" class="__class__" href="__link__" target="__target__" onclick="__onclick__">__title__</a>
 	    </li>
 	    </li>
 	</bx_repeat:menu_items>
 	</bx_repeat:menu_items>
-    <div class="bx-clear"></div>
 </ul>
 </ul>
 <script type="text/javascript" language="javascript">
 <script type="text/javascript" language="javascript">
     $(document).ready(function() {
     $(document).ready(function() {

+ 148 - 133
template/scripts/BxBaseCmtsView.php

@@ -28,6 +28,66 @@ class BxBaseCmtsView extends BxDolCmts {
         BxDolTemplate::getInstance()->addJsTranslation('_sys_txt_cmt_loading');
         BxDolTemplate::getInstance()->addJsTranslation('_sys_txt_cmt_loading');
     }
     }
 
 
+	/**
+     * Get comments css file string
+     *
+     * @return string
+     */
+    function getExtraCss ()
+    {
+        BxDolTemplate::getInstance()->addCss(array('cmts.css'));
+    }
+
+    /**
+     * Get comments js file string
+     *
+     * @return string
+     */
+    function getExtraJs ()
+    {
+        BxDolTemplate::getInstance()->addJs(array('common_anim.js', 'BxDolCmts.js'));
+    }
+
+	/**
+     * Get initialization section of comments box
+     *
+     * @return string
+     */
+    function getScript()
+    {
+        $sToggleAdd = '';
+
+        $ret = '';
+        $ret .= $sToggleAdd . "
+            <script  type=\"text/javascript\">
+                var " . $this->_sJsObjName . " = new BxDolCmts({
+                    sObjName: '" . $this->_sJsObjName . "',
+                    sBaseUrl: '" . BX_DOL_URL_ROOT . "',
+                    sSystem: '" . $this->getSystemName() . "',
+                    sSystemTable: '" . $this->_aSystem['table_cmts'] . "',
+                    iAuthorId: '" . $this->_getAuthorId() . "',
+                    iObjId: '" . $this->getId () . "',
+                    sPostFormPosition: '" . $this->_aSystem['post_form_position'] . "',
+    				sBrowseType: '" . $this->_sBrowseType . "',
+    				sDisplayType: '" . $this->_sDisplayType . "'});
+                " . $this->_sJsObjName . ".oCmtElements = {";
+        for (reset($this->_aCmtElements); list($k,$r) = each ($this->_aCmtElements); ) {
+            $ret .= "\n'$k' : { 'reg' : '{$r['reg']}', 'msg' : \"". bx_js_string(trim($r['msg'])) . "\" },";
+        }
+        $ret = substr($ret, 0, -1);
+        $ret .= "\n};\n";
+        $ret .= "</script>";
+
+        $this->getExtraJs();
+        $this->getExtraCss();
+        BxDolTemplate::getInstance()->addJsTranslation(array(
+        	'_Error occured',
+        	'_Are you sure?'
+        ));
+        
+        return $ret;
+    }
+
     /**
     /**
      * get full comments block with initializations
      * get full comments block with initializations
      */
      */
@@ -49,7 +109,7 @@ class BxBaseCmtsView extends BxDolCmts {
     		'comments' => $sCmts,
     		'comments' => $sCmts,
     		'post_form_top' => $this->_getPostReplyBox($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_TOP)),
     		'post_form_top' => $this->_getPostReplyBox($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_TOP)),
 			'post_form_bottom'  => $this->_getPostReplyBox($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM)),
 			'post_form_bottom'  => $this->_getPostReplyBox($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM)),
-    		'script' => $this->getCmtsInit()
+    		'script' => $this->getScript()
     	));
     	));
     }
     }
 
 
@@ -70,7 +130,7 @@ class BxBaseCmtsView extends BxDolCmts {
 
 
 		$sCmts = '';
 		$sCmts = '';
 		foreach($aCmts as $k => $r)
 		foreach($aCmts as $k => $r)
-			$sCmts .= $this->getComment($r, $aDp);
+			$sCmts .= $this->getComment($r, $aBp, $aDp);
 
 
 		$sCmts = $this->_getMoreLink($sCmts, $aBp, $aDp);
 		$sCmts = $this->_getMoreLink($sCmts, $aBp, $aDp);
 		return $sCmts;
 		return $sCmts;
@@ -84,8 +144,8 @@ class BxBaseCmtsView extends BxDolCmts {
     	return BxDolTemplate::getInstance()->parseHtmlByName('comment_block.html', array(
     	return BxDolTemplate::getInstance()->parseHtmlByName('comment_block.html', array(
     		'system' => $this->_sSystem,
     		'system' => $this->_sSystem,
     		'id' => $this->getId(),
     		'id' => $this->getId(),
-    		'comment' => $this->getComment($iCmtId, array('type' => BX_CMT_DISPLAY_THREADED, 'opened' => true)),
-    		'script' => $this->getCmtsInit()
+    		'comment' => $this->getComment($iCmtId, array(), array('type' => BX_CMT_DISPLAY_THREADED, 'opened' => true)),
+    		'script' => $this->getScript()
     	));
     	));
     }
     }
 
 
@@ -95,14 +155,14 @@ class BxBaseCmtsView extends BxDolCmts {
      * @param int $iCmtId - comment id
      * @param int $iCmtId - comment id
      * @return string
      * @return string
      */
      */
-    function getComment($mixedCmt, $aDp = array())
+    function getComment($mixedCmt, $aBp = array(), $aDp = array())
     {
     {
     	$oTemplate = BxDolTemplate::getInstance();
     	$oTemplate = BxDolTemplate::getInstance();
 
 
     	$iUserId = $this->_getAuthorId();
     	$iUserId = $this->_getAuthorId();
     	$r = !is_array($mixedCmt) ? $this->getCommentRow((int)$mixedCmt) : $mixedCmt;
     	$r = !is_array($mixedCmt) ? $this->getCommentRow((int)$mixedCmt) : $mixedCmt;
 
 
-        list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($r);
+        list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($r['cmt_author_id']);
 
 
         $sClass = $sRet = '';
         $sClass = $sRet = '';
         if($r['cmt_rated'] == -1 || $r['cmt_rate'] < $this->_aSystem['viewing_threshold']) {
         if($r['cmt_rated'] == -1 || $r['cmt_rate'] < $this->_aSystem['viewing_threshold']) {
@@ -140,7 +200,7 @@ class BxBaseCmtsView extends BxDolCmts {
 		$aTmplReplyTo = array();
 		$aTmplReplyTo = array();
 		if((int)$r['cmt_parent_id'] != 0) {
 		if((int)$r['cmt_parent_id'] != 0) {
 			$aParent = $this->getCommentRow($r['cmt_parent_id']);
 			$aParent = $this->getCommentRow($r['cmt_parent_id']);
-			list($sParAuthorName, $sParAuthorLink, $sParAuthorIcon) = $this->_getAuthorInfo($aParent);
+			list($sParAuthorName, $sParAuthorLink, $sParAuthorIcon) = $this->_getAuthorInfo($aParent['cmt_author_id']);
 
 
 			$aTmplReplyTo = array(
 			$aTmplReplyTo = array(
 				'style_prefix' => $this->_sStylePrefix,
 				'style_prefix' => $this->_sStylePrefix,
@@ -151,15 +211,25 @@ class BxBaseCmtsView extends BxDolCmts {
  
  
 		$sReplies = '';
 		$sReplies = '';
 		if((int)$r['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED && $aDp['opened'])
 		if((int)$r['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED && $aDp['opened'])
-			$sReplies = $this->getComments(array('parent_id' => $r['cmt_id']));
+			$sReplies = $this->getComments(array('parent_id' => $r['cmt_id'], 'type' => $aBp['type']), $aDp);
 
 
+		$bAuthorIcon = !empty($sAuthorIcon);
         return $oTemplate->parseHtmlByName('comment.html', array(
         return $oTemplate->parseHtmlByName('comment.html', array(
         	'system' => $this->_sSystem,
         	'system' => $this->_sSystem,
         	'style_prefix' => $this->_sStylePrefix,
         	'style_prefix' => $this->_sStylePrefix,
         	'id' => $r['cmt_id'],
         	'id' => $r['cmt_id'],
         	'class' => $sClass,
         	'class' => $sClass,
         	'margin' => $this->_getLevelGap($r, $aDp),
         	'margin' => $this->_getLevelGap($r, $aDp),
-        	'author_icon' => $sAuthorIcon,
+        	'bx_if:show_icon' => array(
+        		'condition' => $bAuthorIcon,
+        		'content' => array(
+        			'author_icon' => $sAuthorIcon
+        		)
+        	),
+        	'bx_if:show_icon_empty' => array(
+        		'condition' => !$bAuthorIcon,
+        		'content' => array()
+        	),
         	'bx_if:show_author_link' => array(
         	'bx_if:show_author_link' => array(
         		'condition' => !empty($sAuthorLink),
         		'condition' => !empty($sAuthorLink),
         		'content' => array(
         		'content' => array(
@@ -200,67 +270,6 @@ class BxBaseCmtsView extends BxDolCmts {
         return $this->_getPostReplyForm($iCmtParentId, $sText, $sFunction);
         return $this->_getPostReplyForm($iCmtParentId, $sText, $sFunction);
     }
     }
 
 
-    /**
-     * Get comments css file string
-     *
-     * @return string
-     */
-    function getExtraCss ()
-    {
-        BxDolTemplate::getInstance()->addCss('cmts.css');
-    }
-
-    /**
-     * Get comments js file string
-     *
-     * @return string
-     */
-    function getExtraJs ()
-    {
-        BxDolTemplate::getInstance()->addJs(array('common_anim.js', 'BxDolCmts.js'));
-    }
-
-    /**
-     * Get initialization section of comments box
-     *
-     * @return string
-     */
-    function getCmtsInit()
-    {
-        $sToggleAdd = '';
-
-        $ret = '';
-        $ret .= $sToggleAdd . "
-            <script  type=\"text/javascript\">
-                var " . $this->_sJsObjName . " = new BxDolCmts({
-                    sObjName: '" . $this->_sJsObjName . "',
-                    sBaseUrl: '" . BX_DOL_URL_ROOT . "',
-                    sSystem: '" . $this->getSystemName() . "',
-                    sSystemTable: '" . $this->_aSystem['table_cmts'] . "',
-                    iAuthorId: '" . $this->_getAuthorId() . "',
-                    iObjId: '" . $this->getId () . "',
-                    sOrder: '" . $this->getOrder() . "',
-                    sPostFormPosition: '" . $this->_aSystem['post_form_position'] . "',
-    				sBrowseType: '" . $this->_sBrowseType . "',
-    				sDisplayType: '" . $this->_sDisplayType . "'});
-                " . $this->_sJsObjName . ".oCmtElements = {";
-        for (reset($this->_aCmtElements); list($k,$r) = each ($this->_aCmtElements); ) {
-            $ret .= "\n'$k' : { 'reg' : '{$r['reg']}', 'msg' : \"". bx_js_string(trim($r['msg'])) . "\" },";
-        }
-        $ret = substr($ret, 0, -1);
-        $ret .= "\n};\n";
-        $ret .= "</script>";
-
-        $this->getExtraJs();
-        $this->getExtraCss();
-        BxDolTemplate::getInstance()->addJsTranslation(array(
-        	'_Error occured',
-        	'_Are you sure?'
-        ));
-        
-        return $ret;
-    }
-
     /**
     /**
      * private functions
      * private functions
      */
      */
@@ -382,13 +391,13 @@ class BxBaseCmtsView extends BxDolCmts {
     	if(!$this->isPostReplyAllowed())
     	if(!$this->isPostReplyAllowed())
     		return '';
     		return '';
 
 
-    	bx_import('BxDolProfile');
-		$oProfile = BxDolProfile::getInstanceAccountProfile($this->_getAuthorId());
+    	list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo();
 
 
 		$sPositionSystem = $this->_aSystem['post_form_position'];
 		$sPositionSystem = $this->_aSystem['post_form_position'];
 		if(!empty($sPosition) && $sPositionSystem != BX_CMT_PFP_BOTH && $sPositionSystem != $sPosition)
 		if(!empty($sPosition) && $sPositionSystem != BX_CMT_PFP_BOTH && $sPositionSystem != $sPosition)
 			return '';
 			return '';
 
 
+		$bAuthorIcon = !empty($sAuthorIcon);
     	return BxDolTemplate::getInstance()->parseHtmlByName('comment_reply_box.html', array(
     	return BxDolTemplate::getInstance()->parseHtmlByName('comment_reply_box.html', array(
     		'style_prefix' => $this->_sStylePrefix,
     		'style_prefix' => $this->_sStylePrefix,
     		'margin' => $this->_getLevelGapByParent($iCmtParentId, $aDp),
     		'margin' => $this->_getLevelGapByParent($iCmtParentId, $aDp),
@@ -398,19 +407,63 @@ class BxBaseCmtsView extends BxDolCmts {
     				'class' => $this->_sStylePrefix . '-reply-' . $sPosition
     				'class' => $this->_sStylePrefix . '-reply-' . $sPosition
     			)
     			)
     		),
     		),
-    		'author_icon' => $oProfile->getThumb(),
+    		'bx_if:show_icon' => array(
+        		'condition' => $bAuthorIcon,
+        		'content' => array(
+        			'author_icon' => $sAuthorIcon
+        		)
+        	),
+        	'bx_if:show_icon_empty' => array(
+        		'condition' => !$bAuthorIcon,
+        		'content' => array()
+        	),
 			'form' => $this->_getPostReplyForm($iCmtParentId)
 			'form' => $this->_getPostReplyForm($iCmtParentId)
     	));
     	));
     }
     }
 
 
     function _getPostReplyForm($iCmtParentId = 0, $sText = "", $sFunction = "cmtSubmit(this)")
     function _getPostReplyForm($iCmtParentId = 0, $sText = "", $sFunction = "cmtSubmit(this)")
     {
     {
-    	return BxDolTemplate::getInstance()->parseHtmlByName('comment_reply_form.html', array(
-    		'js_object' => $this->_sJsObjName,
-    		'js_function' => $sFunction,
-    		'parent_id' => $iCmtParentId,
-    		'text' => bx_process_output($sText)
-    	));
+    	$aForm = array(
+			'form_attrs' => array(
+				'name' => 'cmt-post-reply-' . $this->_sSystem,
+				'method' => 'post',
+    			'onsubmit' => $this->_sJsObjName . '.' . $sFunction . '; return false;',
+    			'class' => 'cmt-post-reply'
+			 ), 
+			'params' => array (
+				'csrf' => array(
+					'disable' => true,
+				)
+			),
+			'inputs' => array(
+				'CmtParent' => array(
+					'type' => 'hidden',
+					'name' => 'CmtParent',
+					'value' => $iCmtParentId
+				),
+				'CmtType' => array(
+					'type' => 'hidden',
+					'name' => 'CmtType',
+					'value' => 'text'
+				),
+				'CmtText' => array(
+					'type' => 'textarea',
+					'name' => 'CmtText',
+					'caption' => '',
+					'value' => $sText,
+					'required' => false,
+				),
+				'CmtControls' => array(
+					'type' => 'input_set',
+					0 => array('type' => 'submit', 'name' => 'CmtSubmit', 'value' => _t('_Submit_Comment')),
+					1 => array('type' => 'switcher', 'name' => 'CmtSubscribe', 'label' => _t('_cmt_track_replies')),
+				)
+			)
+		);
+
+		bx_import('BxTemplFormView');
+		$oForm = new BxTemplFormView ($aForm);
+		return $oForm->getCode();
     }
     }
 
 
 	function _getMoreLink($sCmts, $aBp = array(), $aDp = array())
 	function _getMoreLink($sCmts, $aBp = array(), $aDp = array())
@@ -418,6 +471,8 @@ class BxBaseCmtsView extends BxDolCmts {
     	$iStart = $iPerView = 0;
     	$iStart = $iPerView = 0;
     	switch($aBp['type']) {
     	switch($aBp['type']) {
     		case BX_CMT_BROWSE_HEAD:
     		case BX_CMT_BROWSE_HEAD:
+    		case BX_CMT_BROWSE_POPULAR:
+    		case BX_CMT_BROWSE_CONNECTION:
     			$iPerView = $aBp['per_view'];
     			$iPerView = $aBp['per_view'];
 
 
     			$iStart = $aBp['start'] + $iPerView;
     			$iStart = $aBp['start'] + $iPerView;
@@ -441,17 +496,30 @@ class BxBaseCmtsView extends BxDolCmts {
     			break;
     			break;
     	}
     	}
 
 
+    	$bRoot = (int)$aBp['parent_id'] <= 0;
+
     	$sMore = BxDolTemplate::getInstance()->parseHtmlByName('comment_more.html', array(
     	$sMore = BxDolTemplate::getInstance()->parseHtmlByName('comment_more.html', array(
 			'js_object' => $this->_sJsObjName,
 			'js_object' => $this->_sJsObjName,
 			'style_prefix' => $this->_sStylePrefix,
 			'style_prefix' => $this->_sStylePrefix,
+    		'bx_if:is_root' => array(
+    			'condition' => $bRoot,
+    			'content' => array()
+    		),
     		'margin' => $this->_getLevelGapByParent($aBp['parent_id'], $aDp),
     		'margin' => $this->_getLevelGapByParent($aBp['parent_id'], $aDp),
+    		'bx_if:is_button' => array(
+    			'condition' => $bRoot,
+    			'content' => array()
+    		),
 			'parent_id' => $aBp['parent_id'],
 			'parent_id' => $aBp['parent_id'],
     		'start' => $iStart,
     		'start' => $iStart,
-    		'per_view' => $iPerView
+    		'per_view' => $iPerView,
+    		'title' => _t('_load_more_comments_' . $aBp['type'])
 		));
 		));
 
 
     	switch($aBp['type']) {
     	switch($aBp['type']) {
     		case BX_CMT_BROWSE_HEAD:
     		case BX_CMT_BROWSE_HEAD:
+    			case BX_CMT_BROWSE_POPULAR:
+    			case BX_CMT_BROWSE_CONNECTION:
     			$sCmts .= $sMore;
     			$sCmts .= $sMore;
     			break;
     			break;
 
 
@@ -481,57 +549,4 @@ class BxBaseCmtsView extends BxDolCmts {
 
 
 		return $this->_getLevelGap($a, $aDp);
 		return $this->_getLevelGap($a, $aDp);
     }
     }
-
-	function _getAuthorInfo($r)
-    {
-    	$sAuthorName = _t('_Anonymous');
-    	$sAuthorLink = ''; 
-        $sAuthorIcon = '';
-
-		if((int)$r['cmt_author_id'] != 0) {
-			$oProfile = BxDolProfile::getInstanceAccountProfile($r['cmt_author_id']);
-
-			$sAuthorName = $oProfile->getDisplayName();
-			$sAuthorLink = $oProfile->getUrl();
-			$sAuthorIcon = $oProfile->getThumb();
-		}
-
-		return array($sAuthorName, $sAuthorLink, $sAuthorIcon);
-    }
-
-	function _prepareParams(&$aBp, &$aDp)
-    {
-    	$aBp['type'] = isset($aBp['type']) && !empty($aBp['type']) ? $aBp['type'] : $this->_sBrowseType;
-    	$aBp['parent_id'] = isset($aBp['parent_id']) ? $aBp['parent_id'] : 0;
-    	$aBp['start'] = isset($aBp['start']) ? $aBp['start'] : -1;
-    	$aBp['per_view'] = isset($aBp['per_view']) ? $aBp['per_view'] : -1;
-    	$aBp['order'] = isset($aBp['order']) ? $aBp['order'] : $this->_sOrder;
-
-    	$aDp['type'] = isset($aDp['type']) && !empty($aDp['type']) ? $aDp['type'] : $this->_sDisplayType;
-    	$aDp['opened'] = isset($aDp['opened']) ? $aDp['opened'] : $this->_bDpOpened;
-
-		switch($aDp['type']) {
-			case BX_CMT_DISPLAY_FLAT:
-				$aBp['parent_id'] = -1;
-				$aBp['per_view'] = $aBp['per_view'] != -1 ? $aBp['per_view'] : $this->getPerView(0);
-				break;
-
-			case BX_CMT_DISPLAY_THREADED:
-				$aBp['per_view'] = $aBp['per_view'] != -1 ? $aBp['per_view'] : $this->getPerView($aBp['parent_id']);
-				break;
-		}
-
-		$aBp['count'] = $this->_oQuery->getCommentsCount($this->_iId, $aBp['parent_id']);
-		if($aBp['start'] != -1)
-			return;
-
-		$aBp['start'] = 0;
-		if($aBp['type'] == BX_CMT_BROWSE_TAIL) {
-			$aBp['start'] = $aBp['count'] - $aBp['per_view'];
-			if($aBp['start'] < 0) {
-    			$aBp['per_view'] += $aBp['start'];
-    			$aBp['start'] = 0;
-			}
-		}
-    }
 }
 }