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

Ticket #918 - Forum and Conversations.

AntonLV пре 9 година
родитељ
комит
bafd141143

+ 12 - 12
inc/classes/BxDolCmts.php

@@ -371,6 +371,18 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return $iCmtParentId == 0 ? $this->_aSystem['per_view'] : $this->_aSystem['per_view_replies'];
     }
 
+	public function getViewUrl($iCmtId)
+    {
+    	if(empty($this->_aSystem['trigger_field_title']))
+    		return '';
+
+    	return bx_append_url_params($this->_sViewUrl, array(
+			'sys' => $this->_sSystem,
+			'id' => $this->_iId,
+			'cmt_id' => $iCmtId
+		));
+    }
+
     public function getBaseUrl()
     {
         return $this->_replaceMarkers($this->_sBaseUrl);
@@ -404,18 +416,6 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return ($bWithHash ? '#' : '') . sprintf($this->_sItemAnchor, str_replace('_', '-', $this->getSystemName()), $this->getId(), $iItemId);
     }
 
-	public function getViewUrl($iCmtId)
-    {
-    	if(empty($this->_aSystem['trigger_field_title']))
-    		return '';
-
-    	return bx_append_url_params($this->_sViewUrl, array(
-			'sys' => $this->_sSystem,
-			'id' => $this->_iId,
-			'cmt_id' => $iCmtId
-		));
-    }
-
     public function getConnectionObject($sType)
     {
         $sResult = '';

+ 9 - 2
modules/boonex/convos/classes/BxCnvModule.php

@@ -258,30 +258,37 @@ class BxCnvModule extends BxBaseModTextModule
      */
     public function serviceTriggerCommentPost ($iContentId, $iProfileId, $iCommentId, $iTimestamp = 0, $sCommentText = '')
     {
+        $CNF = &$this->_oConfig->CNF;
+        
         if (!(int)$iContentId)
             return false;
         $aContentInfo = $this->_oDb->getContentInfoById((int)$iContentId);
         if (!$aContentInfo)
             return false;
 
+        $oCmts = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
+        if(!$oCmts)
+            return false;
+            
         if (!$iTimestamp)
             $iTimestamp = time();
 
         if ($iProfileId == bx_get_logged_profile_id())
-            $this->_oDb->updateReadComments($iProfileId, $aContentInfo[$this->_oConfig->CNF['FIELD_ID']], $aContentInfo[$this->_oConfig->CNF['FIELD_COMMENTS']]);
+            $this->_oDb->updateReadComments($iProfileId, $aContentInfo[$CNF['FIELD_ID']], $aContentInfo[$CNF['FIELD_COMMENTS']]);
 
         if (!$this->_oDb->updateLastCommentTimeProfile((int)$iContentId, (int)$iProfileId, (int)$iCommentId, $iTimestamp))
             return false;
 
         // send notification to all collaborators
         if ($oProfile = BxDolProfile::getInstance($iProfileId)) {
-            $aCollaborators = $this->_oDb->getCollaborators($aContentInfo[$this->_oConfig->CNF['FIELD_ID']]);
+            $aCollaborators = $this->_oDb->getCollaborators($aContentInfo[$CNF['FIELD_ID']]);
             foreach ($aCollaborators as $iCollaborator => $iReadComments) {
                 if ($iCollaborator == $iProfileId)
                     continue;
                 sendMailTemplate('bx_cnv_new_reply', 0, $iCollaborator, array(
                     'SenderDisplayName' => $oProfile->getDisplayName(),
                     'SenderUrl' => $oProfile->getUrl(),
+                	'ReplyUrl' => $oCmts->getItemUrl($iCommentId),
                     'Message' => $sCommentText,
                 ), BX_EMAIL_NOTIFY);
             }

+ 1 - 1
modules/boonex/convos/install/langs/en.xml

@@ -128,7 +128,7 @@
     <string name="_bx_cnv_email_new_reply"><![CDATA[New reply]]></string>
     <string name="_bx_cnv_email_new_reply_subject"><![CDATA[New reply from {SenderDisplayName}]]></string>
     <string name="_bx_cnv_email_new_reply_body"><![CDATA[{email_header}
-<p>New reply from <a href="{SenderUrl}">{SenderDisplayName}</a>:</p>
+<p>New <a href="{ReplyUrl}">reply</a> from <a href="{SenderUrl}">{SenderDisplayName}</a>:</p>
 <hr />
 <p>{Message}</p>
 {email_footer}]]></string>

+ 5 - 0
modules/boonex/forum/classes/BxForumModule.php

@@ -327,6 +327,10 @@ class BxForumModule extends BxBaseModTextModule
         if(!$aContentInfo)
 			return false;
 
+        $oCmts = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
+        if(!$oCmts)
+            return false;
+
         if(!$iTimestamp)
 			$iTimestamp = time();
 
@@ -340,6 +344,7 @@ class BxForumModule extends BxBaseModTextModule
                 sendMailTemplate('bx_forum_new_reply', 0, $aContentInfo[$CNF['FIELD_AUTHOR']], array(
                     'SenderDisplayName' => $oProfile->getDisplayName(),
                     'SenderUrl' => $oProfile->getUrl(),
+                    'ReplyUrl' => $oCmts->getItemUrl($iCommentId),
                     'Message' => $sCommentText,
                 ), BX_EMAIL_NOTIFY);
         }

+ 1 - 1
modules/boonex/forum/install/langs/en.xml

@@ -264,7 +264,7 @@
     <string name="_bx_forum_email_new_reply"><![CDATA[New reply]]></string>
     <string name="_bx_forum_email_new_reply_subject"><![CDATA[New reply from {SenderDisplayName}]]></string>
     <string name="_bx_forum_email_new_reply_body"><![CDATA[{email_header}
-<p>New reply from <a href="{SenderUrl}">{SenderDisplayName}</a>:</p>
+<p>New <a href="{ReplyUrl}">reply</a> from <a href="{SenderUrl}">{SenderDisplayName}</a>:</p>
 <hr />
 <p>{Message}</p>
 {email_footer}]]></string>

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

@@ -128,7 +128,7 @@
     <string name="_bx_cnv_email_new_reply"><![CDATA[Новый ответ]]></string>
     <string name="_bx_cnv_email_new_reply_subject"><![CDATA[Новый ответ от {SenderDisplayName}]]></string>
     <string name="_bx_cnv_email_new_reply_body"><![CDATA[{email_header}
-<p>Новый ответ от <a href="{SenderUrl}">{SenderDisplayName}</a>:</p>
+<p>Новый <a href="{ReplyUrl}">ответ</a> от <a href="{SenderUrl}">{SenderDisplayName}</a>:</p>
 <hr />
 <p>{Message}</p>
 {email_footer}]]></string>

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

@@ -263,7 +263,7 @@
     <string name="_bx_forum_email_new_reply"><![CDATA[Новый ответ]]></string>
     <string name="_bx_forum_email_new_reply_subject"><![CDATA[Новый ответ от {SenderDisplayName}]]></string>
     <string name="_bx_forum_email_new_reply_body"><![CDATA[{email_header}
-<p>Новый ответ от <a href="{SenderUrl}">{SenderDisplayName}</a>:</p>
+<p>Новый <a href="{ReplyUrl}">ответ</a> от <a href="{SenderUrl}">{SenderDisplayName}</a>:</p>
 <hr />
 <p>{Message}</p>
 {email_footer}]]></string>