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

Ticket #4971 - Build-in API support: Tasks.

AntonLV пре 3 месеци
родитељ
комит
11eecb46c1

+ 3 - 6
inc/classes/BxDolCmts.php

@@ -2590,15 +2590,12 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
                     $aMenuManage = $oMenuManage->getShortCodeAPI();
             }
 
-            $aData = $this->getCommentSimple($iCmtId);
-
             bx_import('BxDolEmbed');
-            $aData['embed'] = bx_linkify_embeded($aData['cmt_text']);
-
-            $aData = array_merge($this->getDataAPI($aData), [
+            $aData = $this->getDataAPI(array_merge($this->getCommentSimple($iCmtId), [
+                'embed' => bx_linkify_embeded($aData['cmt_text']),
                 'menu_actions' => $aMenuActions,
                 'menu_manage' => $aMenuManage,
-            ]);
+            ]));
 
             $aStructure[$sCmtIndex] = [
                 'id' => $iCmtId, 

+ 6 - 3
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -4796,9 +4796,12 @@ class BxBaseModGeneralModule extends BxDolModule
         if (!$oCmts || !$oCmts->isEnabled())
             return false;
         
-        if (bx_is_api()){
-            return [bx_srv('system', 'get_data_api', [['module' => $sObject, 'object_id' => $iId]], 'TemplCmtsServices')];
-        }
+        if($this->_bIsApi)
+            return [
+                'title' => $oCmts->getCommentsBlockTitle(),
+                'content' => [bx_srv('system', 'get_data_api', [['module' => $sObject, 'object_id' => $iId]], 'TemplCmtsServices')]
+            ];
+
         return $oCmts->getCommentsBlock([], ['in_designbox' => false, 'show_empty' => false]);
     }
 

+ 6 - 1
template/scripts/BxBaseCmts.php

@@ -192,6 +192,11 @@ class BxBaseCmts extends BxDolCmts
         
     }
 
+    function getCommentsBlockTitle()
+    {
+        return _t($this->_aT['block_comments_title'], $this->getCommentsCountAll(0, true));
+    }
+
     /**
      * get full comments block with initializations
      */
@@ -227,7 +232,7 @@ class BxBaseCmts extends BxDolCmts
         $sPostFormBottom = $this->getFormBoxPost($aBp, array_merge($aDp, ['type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM]));
         $sJsContent = $this->getJsScript($aBp, $aDp);
 
-        $sBlockTitle = _t($this->_aT['block_comments_title'], $this->getCommentsCountAll(0, true));
+        $sBlockTitle = $this->getCommentsBlockTitle();
         $sBlockMenu = $this->_getControlsBox();
 
         /**

+ 6 - 2
template/scripts/BxBaseMenu.php

@@ -347,8 +347,12 @@ class BxBaseMenu extends BxDolMenu
                 $this->addMarkers($aMarkers);
             $aResult = $this->_replaceMarkers($aResult);
 
-            if(!empty($aResult['link']))
-                $aResult['link'] = $this->_oPermalinks->permalink($aResult['link']);
+            if(!empty($aResult['link'])) {
+                if(($sSubstr = 'javascript') && substr($aResult['link'], 0, strlen($sSubstr)) == $sSubstr)
+                    $aResult['link'] = '';
+                else
+                    $aResult['link'] = $this->_oPermalinks->permalink($aResult['link']);
+            }
 
             if($this->isMultilevel() && !empty($a['subitems'])) {
                 $aSubitems = [];