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

Ticket #3694 - Minor fixes: Attachments in comments.

AntonLV 4 лет назад
Родитель
Сommit
44ee38f282

+ 1 - 1
inc/classes/BxDolCmts.php

@@ -1398,7 +1398,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
             if($oTranscoder && $oTranscoder->isMimeTypeSupported($aSibling['mime_type']))
                 $sFile = $oStorage->getFileUrlById($aSibling['image_id']);
             else
-                $sFile = $oStorage->getFontIconNameByFileName($aFile['file_name']);
+                $sFile = $this->_oTemplate->getIconUrl($oStorage->getIconNameByFileName($aFile['file_name']));
 
             $aImageInfo = BxDolImageResize::getInstance()->getImageSize($sFile);
 

+ 1 - 1
modules/boonex/artificer/data/template/bx_forum/comment_attachments.html

@@ -1,7 +1,7 @@
 <bx_repeat:attached>
     <div class="__style_prefix__-attached-preview bx-forum-attached-preview p-1">
         <bx_if:show_image>
-            <a href="javascript:void(0)" onclick="__js_object__.showImage(this, '__file__'); return false;" title="<bx_text_attribute:_cmt_view_attached_image />">
+            <a href="javascript:void(0)" onclick="__js_object__.showImage(event || window.event, this)" data-file-id="__file_id__" data-src="__file__" data-w="__w__" data-h="__h__" title="<bx_text_attribute:_cmt_view_attached_image />">
                 <img class="bg-contain" src="<bx_image_url:spacer.gif />" style="background-image:url(__preview__)" /> __file_name__ <span class="bx-def-font-grayed">__file_size__</span>
             </a>
         </bx_if:show_image>

+ 1 - 1
modules/boonex/artificer/data/template/system/comment_attachments.html

@@ -2,7 +2,7 @@
     <bx_repeat:attached>
         <div class="__style_prefix__-attached-preview w-24 h-24 m-1">
             <bx_if:show_image>
-                <a href="javascript:void(0)" onclick="__js_object__.showImage(this, '__file__'); return false;" title="<bx_text_attribute:_cmt_view_attached_image />">
+                <a href="javascript:void(0)" onclick="__js_object__.showImage(event || window.event, this)" data-file-id="__file_id__" data-src="__file__" data-w="__w__" data-h="__h__" title="<bx_text_attribute:_cmt_view_attached_image />">
                     <img class="w-24 h-24 rounded" src="<bx_image_url:spacer.gif />" style="background-image:url(__preview__)" />
                 </a>
             </bx_if:show_image>

+ 11 - 1
modules/boonex/forum/classes/BxForumCmts.php

@@ -75,11 +75,21 @@ class BxForumCmts extends BxTemplCmts
     public function getCommentsBlock($aBp = array(), $aDp = array())
     {
         $mixedBlock = parent::getCommentsBlock($aBp, $aDp);
-        if (is_array($mixedBlock) && isset($mixedBlock['title']))
+        if(is_array($mixedBlock) && isset($mixedBlock['title']))
             $mixedBlock['title'] = _t('_bx_forum_page_block_title_entry_comments', $this->getCommentsCount());
+
         return $mixedBlock;
     }
     
+    public function getCommentBlock($iCmtId = 0, $aBp = [], $aDp = [])
+    {
+        $sResult = parent::getCommentBlock($iCmtId, $aBp, $aDp);
+        if(!empty($sResult))
+            $this->_oModule->_oTemplate->addCss('main.css');
+
+        return $sResult;
+    }
+    
     protected function _getCounterItems($iCmtsLimit, $iCmtsStart = 0)
     {
         $aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_iId);

+ 8 - 9
modules/boonex/forum/template/comment_attachments.html

@@ -1,11 +1,10 @@
 <bx_repeat:attached>
-	<div class="__style_prefix__-attached-preview bx-forum-attached-preview bx-def-round-corners bx-def-padding-thd">
-		<bx_if:show_image>
-			<a href="javascript:void(0)" onclick="__js_object__.showImage(this, '__file__'); return false;" title="<bx_text_attribute:_cmt_view_attached_image />"><img src="<bx_image_url:spacer.gif />" style="background-image:url(__preview__)" /> __file_name__ <span class="bx-def-font-grayed">__file_size__</span></a>
-		</bx_if:show_image>
-		<bx_if:show_file>
-			
-			<a href="__file__" title="<bx_text_attribute:_cmt_download_attached_file />"><i class="sys-icon __file_icon__"></i> __file_name__ <span class="bx-def-font-grayed">__file_size__</span></a>
-		</bx_if:show_file>
-	</div>
+    <div class="__style_prefix__-attached-preview bx-forum-attached-preview bx-def-round-corners bx-def-padding-thd">
+        <bx_if:show_image>
+            <a href="javascript:void(0)" onclick="__js_object__.showImage(event || window.event, this)" data-file-id="__file_id__" data-src="__file__" data-w="__w__" data-h="__h__" title="<bx_text_attribute:_cmt_view_attached_image />"><img src="<bx_image_url:spacer.gif />" style="background-image:url(__preview__)" /> __file_name__ <span class="bx-def-font-grayed">__file_size__</span></a>
+        </bx_if:show_image>
+        <bx_if:show_file>
+            <a href="__file__" title="<bx_text_attribute:_cmt_download_attached_file />"><i class="sys-icon __file_icon__"></i> __file_name__ <span class="bx-def-font-grayed">__file_size__</span></a>
+        </bx_if:show_file>
+    </div>
 </bx_repeat:attached>

+ 3 - 3
template/scripts/BxBaseCmts.php

@@ -195,7 +195,7 @@ class BxBaseCmts extends BxDolCmts
             'script' => $sJsContent
         ));
 
-        $this->_oTemplate->addInjection ('injection_footer', 'text', $this->_oTemplate->parseHtmlByName('comments_photoswipe.html', []));
+        BxDolTemplate::getInstance()->addInjection ('injection_footer', 'text', $this->_oTemplate->parseHtmlByName('comments_photoswipe.html', []));
 
         return $aDp['in_designbox'] ? DesignBoxContent($sBlockTitle, $sContent, BX_DB_DEF, $sBlockMenu) : array(
             'title' => $sBlockTitle,
@@ -287,7 +287,7 @@ class BxBaseCmts extends BxDolCmts
         if (!$sComment)
             return '';
 
-        $this->_oTemplate->addInjection ('injection_footer', 'text', $this->_oTemplate->parseHtmlByName('comments_photoswipe.html', []));
+        BxDolTemplate::getInstance()->addInjection ('injection_footer', 'text', $this->_oTemplate->parseHtmlByName('comments_photoswipe.html', []));
 
         return $this->_oTemplate->parseHtmlByName('comment_block.html', array(
             'system' => $this->_sSystem,
@@ -463,7 +463,7 @@ class BxBaseCmts extends BxDolCmts
         if(empty($sAddon))
             $sAddon = $this->getJsScript($aBp, $aDp);
 
-        $this->_oTemplate->addInjection ('injection_footer', 'text', $this->_oTemplate->parseHtmlByName('comments_photoswipe.html', []));
+        BxDolTemplate::getInstance()->addInjection ('injection_footer', 'text', $this->_oTemplate->parseHtmlByName('comments_photoswipe.html', []));
 
         return $this->_oTemplate->parseHtmlByName('comment_search.html', array(
             'comment' => $this->getComment($iCmtId, $aBp, $aDp),