Просмотр исходного кода

Ticket #4045 - Reports: Get comments list doesn't work.

AntonLV 4 лет назад
Родитель
Сommit
48efda3300

+ 7 - 5
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -165,18 +165,20 @@ class BxBaseModGeneralModule extends BxDolModule
     {
         $CNF = &$this->_oConfig->CNF;
         if(empty($CNF['OBJECT_NOTES']))
-            return echoJson(array());
+            return echoJson([]);
 
         $iContentId = (int)bx_get('content_id');
 
         $oCmtsNotes = BxDolCmts::getObjectInstance($CNF['OBJECT_NOTES'], $iContentId, true, $this->_oTemplate);
-        $aCmtsNotes = $oCmtsNotes->getCommentsBlock(array(), array('in_designbox' => false));
+        $aCmtsNotes = $oCmtsNotes->getCommentsBlock([], ['in_designbox' => false]);
         if(empty($aCmtsNotes) || !is_array($aCmtsNotes))
-            return echoJson(array());
+            return echoJson([]);
+
+        $sPostfix = $iContentId < 0 ? '_rc' : '';
 
         $sPopupId = $this->getName() . '_notes_' . $iContentId;
-        $sPopupTitle = !empty($CNF['T']['txt_cmts_notes_popup_view_title']) ? $CNF['T']['txt_cmts_notes_popup_view_title'] : '_cmt_nts_popup_view_title';
-        echoJson(array('popup' => BxTemplFunctions::getInstance()->popupBox($sPopupId, _t($sPopupTitle), $aCmtsNotes['content'])));
+        $sPopupTitle = !empty($CNF['T']['txt_cmts_notes_popup_view_title' . $sPostfix]) ? $CNF['T']['txt_cmts_notes_popup_view_title' . $sPostfix] : '_cmt_nts_popup_view_title' . $sPostfix;
+        echoJson(['popup' => BxTemplFunctions::getInstance()->popupBox($sPopupId, _t($sPopupTitle), $aCmtsNotes['content'])]);
     }
     
     public function actionNested()

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

@@ -1901,6 +1901,7 @@
         <string name="_cmt_txt_min_form_placeholder"><![CDATA[{0}, leave your comment here.]]></string>
         <string name="_cmt_txt_note_approve_pending"><![CDATA[Comment will be published as soon as it's approved by moderator]]></string>
         <string name="_cmt_nts_popup_view_title"><![CDATA[Notes]]></string>
+        <string name="_cmt_nts_popup_view_title_rc"><![CDATA[Report's Comments]]></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_txt_min_form_placeholder"><![CDATA[{0}, leave your review here.]]></string>

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

@@ -1881,6 +1881,7 @@
         <string name="_cmt_txt_min_form_placeholder"><![CDATA[{0}, здесь Вы можете оставить комментарий.]]></string>
         <string name="_cmt_txt_note_approve_pending"><![CDATA[Комментарий будет опубликован, как только пройдет проверку модератором.]]></string>
         <string name="_cmt_nts_popup_view_title"><![CDATA[Заметки]]></string>
+        <string name="_cmt_nts_popup_view_title_rc"><![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_txt_min_form_placeholder"><![CDATA[{0}, здесь Вы можете написать обзор.]]></string>

+ 6 - 8
template/report_by_list_with_comments.html

@@ -1,22 +1,20 @@
 <div class="__style_prefix__-by-list-comments">
-	<div class="__style_prefix__-by-items">
-		<bx_repeat:list>
+    <div class="__style_prefix__-by-items">
+        <bx_repeat:list>
             <div class="__style_prefix__-by-item bx-def-padding-sec bx-clearfix bx-form-collapsable bx-form-collapsed">
                 <div class="__style_prefix__-bi-info-list">
                     <div class="__style_prefix__-bi-date">__date__</div>
                     <div class="__style_prefix__-bii-type"><bx_text:_report_reported_as /> <span class="bx-def-font-bold">__type__</span></div>
                     <div class="__style_prefix__-bii-author"><bx_text:_report_reported_by /> <a href="__user_url__">__user_name__</a></div>
-                    <div class="__style_prefix__-bii-comments"><legend><a href="javascript:" onclick="bx_get_reports_comments(__id__)"> __comments_count__</a></legend></div>
+                    <div class="__style_prefix__-bii-comments"><legend><a href="javascript:void(0)" onclick="$(this).parents('.__style_prefix__-by-item:first').find('.__style_prefix__-comments').toggle()"> __comments_count__</a></legend></div>
                 </div>
                 <div class="__style_prefix__-text bx-def-font-grayed bx-clearfix">
                     <bx_if:show_text>
                         <p class="bx-report-bii-text">__text__</p>
                     </bx_if:show_text>
                 </div>
-                <div class="__style_prefix__-comments bx-form-section-content bx-def-padding-sec bx-clearfix">
-                    __comments__
-                </div>
+                <div class="__style_prefix__-comments bx-form-section-content bx-def-padding-sec bx-clearfix">__comments__</div>
             </div>
-		</bx_repeat:list>
-	</div>
+        </bx_repeat:list>
+    </div>
 </div>