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

+ 31 - 4
inc/classes/BxDolCmts.php

@@ -140,6 +140,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
     protected $_sViewUrl = '';
     protected $_sViewUrl = '';
     protected $_sBaseUrl = '';
     protected $_sBaseUrl = '';
     protected $_sListAnchor = '';
     protected $_sListAnchor = '';
+    protected $_sItemAnchor = '';
 
 
     protected $_sSystem = 'profile'; ///< current comment system name
     protected $_sSystem = 'profile'; ///< current comment system name
     protected $_aSystem = array (); ///< current comments system array
     protected $_aSystem = array (); ///< current comments system array
@@ -213,6 +214,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         if(get_mb_substr($this->_sBaseUrl, 0, 4) != 'http')
         if(get_mb_substr($this->_sBaseUrl, 0, 4) != 'http')
             $this->_sBaseUrl = BX_DOL_URL_ROOT . $this->_sBaseUrl;
             $this->_sBaseUrl = BX_DOL_URL_ROOT . $this->_sBaseUrl;
         $this->_sListAnchor = "cmts-anchor-%s-%d";
         $this->_sListAnchor = "cmts-anchor-%s-%d";
+        $this->_sItemAnchor = "cmt-anchor-%s-%d-%d";
 
 
         $this->_oQuery = new BxDolCmtsQuery($this);
         $this->_oQuery = new BxDolCmtsQuery($this);
 
 
@@ -376,12 +378,30 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
 
 
     public function getListUrl()
     public function getListUrl()
     {
     {
-        return $this->getBaseUrl() . '#' . $this->getListAnchor();
+        $sBaseUrl = $this->getBaseUrl();
+        if(empty($sBaseUrl))
+            return '';
+
+        return $sBaseUrl . $this->getListAnchor(true);
+    }
+
+    public function getItemUrl($iItemId)
+    {
+        $sBaseUrl = $this->getBaseUrl();
+        if(empty($sBaseUrl))
+            return '';
+
+        return $sBaseUrl . $this->getItemAnchor($iItemId, true);
+    }
+
+    public function getListAnchor($bWithHash = false)
+    {
+        return ($bWithHash ? '#' : '') . sprintf($this->_sListAnchor, str_replace('_', '-', $this->getSystemName()), $this->getId());
     }
     }
 
 
-    public function getListAnchor()
+    public function getItemAnchor($iItemId, $bWithHash = false)
     {
     {
-        return sprintf($this->_sListAnchor, str_replace('_', '-', $this->getSystemName()), $this->getId());
+        return ($bWithHash ? '#' : '') . sprintf($this->_sItemAnchor, str_replace('_', '-', $this->getSystemName()), $this->getId(), $iItemId);
     }
     }
 
 
 	public function getViewUrl($iCmtId)
 	public function getViewUrl($iCmtId)
@@ -1289,6 +1309,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         if(!empty($sBpFilter))
         if(!empty($sBpFilter))
             $oSession->setValue($this->_sBpSessionKeyFilter . $iUserId, $sBpFilter);
             $oSession->setValue($this->_sBpSessionKeyFilter . $iUserId, $sBpFilter);
     }
     }
+
     protected function _sendNotificationEmail($iCmtId, $iCmtParentId)
     protected function _sendNotificationEmail($iCmtId, $iCmtParentId)
     {
     {
         $aCmt = $this->getCommentRow($iCmtId);
         $aCmt = $this->getCommentRow($iCmtId);
@@ -1306,7 +1327,13 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
 
 
         $aPlus = array();
         $aPlus = array();
         $aPlus['reply_text'] = $this->_prepareTextForOutput($aCmt['cmt_text'], $iCmtId);
         $aPlus['reply_text'] = $this->_prepareTextForOutput($aCmt['cmt_text'], $iCmtId);
-        $aPlus['comment_url'] = sprintf('%scmts.php?sys=%s&id=%d&cmt_id=%d', BX_DOL_URL_ROOT, $this->_sSystem, $this->_iId, $iCmtParentId);
+
+        $sViewUrl = $this->getBaseUrl();
+        if(!empty($sViewUrl))
+            $sViewUrl .= $this->getItemAnchor($iCmtParentId, true);
+        else 
+            $sViewUrl = $this->getViewUrl($iCmtParentId);
+        $aPlus['comment_url'] = $sViewUrl;
 
 
         $aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('t_CommentReplied', $aPlus);
         $aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('t_CommentReplied', $aPlus);
         return $aTemplate && sendMail($aAccount['email'], $aTemplate['Subject'], $aTemplate['Body']);
         return $aTemplate && sendMail($aAccount['email'], $aTemplate['Subject'], $aTemplate['Body']);

+ 1 - 1
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -1073,7 +1073,7 @@ class BxBaseModGeneralModule extends BxDolModule
                 'class' => 'bx-base-general-comments-' . ($bShowAsButton ? 'button' : 'link'),
                 'class' => 'bx-base-general-comments-' . ($bShowAsButton ? 'button' : 'link'),
                 'class_do' => $bShowAsButton ? ' bx-btn' : '',
                 'class_do' => $bShowAsButton ? ' bx-btn' : '',
             	'class_counter' => $bShowAsButton ? ' bx-btn-height' : '',
             	'class_counter' => $bShowAsButton ? ' bx-btn-height' : '',
-                'url' => $sUrl . '#' . $oComments->getListAnchor(),
+                'url' => $sUrl . $oComments->getListAnchor(true),
                 'bx_if:comments' => array (
                 'bx_if:comments' => array (
                     'condition' => $iNum,
                     'condition' => $iNum,
                     'content' => array (
                     'content' => array (

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

@@ -1677,7 +1677,7 @@ If it is not enabled then please consider implement this optimization, since it
 <p>Hello,</p>
 <p>Hello,</p>
 <p>Your comment was replied. It reads:</p>
 <p>Your comment was replied. It reads:</p>
 <p>{reply_text}</p>
 <p>{reply_text}</p>
-<p>Please refer to comment page for more details: <a href="{comment_url}">My Comment</a></p>
+<p>Please refer to comment page for more details <a href="{comment_url}">here</a>.</p>
 {email_footer}]]></string>
 {email_footer}]]></string>
 	<string name="_sys_et_txt_body_system_reported"><![CDATA[{email_header}
 	<string name="_sys_et_txt_body_system_reported"><![CDATA[{email_header}
 <p>Hello,</p>
 <p>Hello,</p>

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

@@ -1675,7 +1675,7 @@
 <p>Привет,</p>
 <p>Привет,</p>
 <p>На Ваш комментарий ответили. Ответ:</p>
 <p>На Ваш комментарий ответили. Ответ:</p>
 <p>{reply_text}</p>
 <p>{reply_text}</p>
-<p>Пожалуйста, перейдите на страницу комментария для дополнительной информации: <a href="{comment_url}">Мой Комментарий</a></p>
+<p>Пожалуйста, перейдите на <a href="{comment_url}">страницу комментария</a> для получения дополнительной информации.</p>
 {email_footer}]]></string>
 {email_footer}]]></string>
 	<string name="_sys_et_txt_body_system_reported"><![CDATA[{email_header}
 	<string name="_sys_et_txt_body_system_reported"><![CDATA[{email_header}
 <p>Привет,</p>
 <p>Привет,</p>

+ 1 - 1
template/comment.html

@@ -1,5 +1,5 @@
 <li id="cmt__id__" class="__style_prefix____class__ bx-def-padding-top bx-def-margin-bottom">
 <li id="cmt__id__" class="__style_prefix____class__ bx-def-padding-top bx-def-margin-bottom">
-	<a id="__system____id__" class="__style_prefix__-anchor bx-anchor-invisible"></a>
+	<a id="__anchor__" class="__style_prefix__-anchor bx-anchor-invisible"></a>
 	<div class="__style_prefix__-cnt__class_cnt__">
 	<div class="__style_prefix__-cnt__class_cnt__">
 		<div class="__style_prefix__-blink-plate"></div>
 		<div class="__style_prefix__-blink-plate"></div>
 		<div class="__style_prefix__-avatar bx-def-thumb-size">__author_unit__</div>
 		<div class="__style_prefix__-avatar bx-def-thumb-size">__author_unit__</div>

+ 1 - 1
template/comments_block.html

@@ -1,7 +1,7 @@
 <div id="cmts-box-__system__-__id__">
 <div id="cmts-box-__system__-__id__">
 	__post_form_top__
 	__post_form_top__
 	<div id="cmt0" class="cmts">
 	<div id="cmt0" class="cmts">
-		<a class="bx-anchor-invisible" name="__list_anchor__"></a>
+		<a id="__list_anchor__" class="bx-anchor-invisible"></a>
 		<ul class="cmts">
 		<ul class="cmts">
 			__comments__
 			__comments__
 		</ul>
 		</ul>

+ 2 - 1
template/scripts/BxBaseCmts.php

@@ -211,7 +211,7 @@ class BxBaseCmts extends BxDolCmts
 
 
             $aTmplReplyTo = array(
             $aTmplReplyTo = array(
                 'style_prefix' => $this->_sStylePrefix,
                 'style_prefix' => $this->_sStylePrefix,
-                'par_cmt_link' => $this->getBaseUrl() . '#' . $this->_sSystem . $aCmt['cmt_parent_id'],
+                'par_cmt_link' => $this->getItemUrl($aCmt['cmt_parent_id']),
             	'par_cmt_title' => bx_html_attribute(_t('_in_reply_to', $sParAuthorName)),
             	'par_cmt_title' => bx_html_attribute(_t('_in_reply_to', $sParAuthorName)),
                 'par_cmt_author' => $sParAuthorName
                 'par_cmt_author' => $sParAuthorName
             );
             );
@@ -232,6 +232,7 @@ class BxBaseCmts extends BxDolCmts
             'style_prefix' => $this->_sStylePrefix,
             'style_prefix' => $this->_sStylePrefix,
             'js_object' => $this->_sJsObjName,
             'js_object' => $this->_sJsObjName,
             'id' => $aCmt['cmt_id'],
             'id' => $aCmt['cmt_id'],
+        	'anchor' => $this->getItemAnchor($aCmt['cmt_id']),
             'class' => $sClass,
             'class' => $sClass,
         	'class_cnt' => $sClassCnt,
         	'class_cnt' => $sClassCnt,
             'bx_if:show_reply_to' => array(
             'bx_if:show_reply_to' => array(