AntonLV 8 лет назад
Родитель
Сommit
ebad45b947

+ 7 - 1
inc/classes/BxDolCmts.php

@@ -140,6 +140,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
 
     protected $_sMenuObjManage;
     protected $_sMenuObjActions;
+    protected $_sMenuObjMeta;
 
     protected $_sViewUrl = '';
     protected $_sBaseUrl = '';
@@ -230,6 +231,7 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
 
         $this->_sMenuObjManage = 'sys_cmts_item_manage';
         $this->_sMenuObjActions = 'sys_cmts_item_actions';
+        $this->_sMenuObjMeta = 'sys_cmts_item_meta';
 
         $this->_sMetatagsObj = 'sys_cmts';
 
@@ -1254,6 +1256,11 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return $this->_oQuery->getCommentsBy(array('type' => 'search_ids', 'search_params' => $aParams, 'start' => $iStart, 'per_page' => $iPerPage));
     }
 
+    public function getAuthorInfo($iAuthorId = 0)
+    {
+        return $this->_getAuthorInfo($iAuthorId);
+    }
+
     /**
      * Internal functions
      */
@@ -1272,7 +1279,6 @@ class BxDolCmts extends BxDolFactory implements iBxDolReplaceable, iBxDolContent
         return getVisitorIP();
     }
 
-
     protected function _getAuthorInfo($iAuthorId = 0)
     {
         $oProfile = $this->_getAuthorObject($iAuthorId);

+ 8 - 0
install/sql/system.sql

@@ -3475,6 +3475,7 @@ INSERT INTO `sys_objects_menu` (`object`, `title`, `set_name`, `module`, `templa
 ('sys_profiles_create', '_sys_menu_title_profiles_create', 'sys_profiles_create', 'system', 4, 0, 1, '', ''),
 ('sys_cmts_item_manage', '_sys_menu_title_cmts_item_manage', 'sys_cmts_item_manage', 'system', 20, 0, 1, 'BxTemplCmtsMenuManage', ''),
 ('sys_cmts_item_actions', '_sys_menu_title_cmts_item_actions', 'sys_cmts_item_actions', 'system', 15, 0, 1, 'BxTemplCmtsMenuActions', ''),
+('sys_cmts_item_meta', '_sys_menu_title_cmts_item_meta', 'sys_cmts_item_meta', 'system', 15, 0, 1, 'BxTemplCmtsMenuUnitMeta', ''),
 ('sys_account_popup', '_sys_menu_title_account_popup', '', 'system', 12, 0, 1, 'BxTemplMenuAccountPopup', ''),
 ('sys_account_notifications', '_sys_menu_title_account_notifications', 'sys_account_notifications', 'system', 19, 0, 1, 'BxTemplMenuAccountNotifications', ''),
 ('sys_profile_stats', '_sys_menu_title_profile_stats', 'sys_profile_stats', 'system', 21, 0, 1, 'BxTemplMenuProfileStats', ''),
@@ -3510,6 +3511,7 @@ INSERT INTO `sys_menu_sets` (`set_name`, `module`, `title`, `deletable`) VALUES
 ('sys_profile_stats', 'system', '_sys_menu_set_title_profile_stats', 0),
 ('sys_cmts_item_manage', 'system', '_sys_menu_set_title_cmts_item_manage', 0),
 ('sys_cmts_item_actions', 'system', '_sys_menu_set_title_cmts_item_actions', 0),
+('sys_cmts_item_meta', 'system', '_sys_menu_set_title_cmts_item_meta', 0),
 ('sys_switch_language', 'system', '_sys_menu_set_title_switch_language', 0),
 ('sys_switch_template', 'system', '_sys_menu_set_title_switch_template', 0),
 ('sys_social_sharing', 'system', '_sys_menu_set_title_sys_social_sharing', 0);
@@ -3605,6 +3607,12 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('sys_cmts_item_actions', 'system', 'item-reply', '_sys_menu_item_title_system_cmts_item_reply', '_sys_menu_item_title_cmts_item_reply', 'javascript:void(0)', 'javascript:{reply_onclick}', '_self', 'reply', '', '', 0, 2147483647, 1, 0, 1, 3),
 ('sys_cmts_item_actions', 'system', 'item-more', '_sys_menu_item_title_system_cmts_item_more', '_sys_menu_item_title_cmts_item_more', 'javascript:void(0)', 'bx_menu_popup(''sys_cmts_item_manage'', this, {''id'':''sys_cmts_item_manage_{cmt_system}_{cmt_id}''}, {cmt_system:''{cmt_system}'', cmt_object_id:{cmt_object_id}, cmt_id:{cmt_id}});', '', 'ellipsis-h', '', 'sys_cmts_item_manage', 1, 2147483647, 1, 0, 1, 4);
 
+-- comment meta info menu
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `submenu_popup`, `visible_for_levels`, `active`, `copyable`, `editable`, `order`) VALUES 
+('sys_cmts_item_meta', 'system', 'author', '_sys_menu_item_title_system_sm_author', '_sys_menu_item_title_sm_author', '', '', '', '', '', '', 0, 2147483647, 1, 0, 1, 1),
+('sys_cmts_item_meta', 'system', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', '', 0, 2147483647, 1, 0, 1, 2),
+('sys_cmts_item_meta', 'system', 'membership', '_sys_menu_item_title_system_sm_membership', '_sys_menu_item_title_sm_membership', '', '', '', '', '', '', 0, 2147483647, 0, 0, 1, 3);
+
 -- social sharing menu
 INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES
 ('sys_social_sharing', 'system', 'social-sharing-facebook', '_sys_menu_item_title_system_social_sharing_facebook', '_sys_menu_item_title_social_sharing_facebook', 'https://www.facebook.com/sharer/sharer.php?u={url_encoded}', '', '_blank', 'fab facebook-f', '', 2147483647, 1, 1, 1),

+ 21 - 0
modules/boonex/decorous/data/template/system/scripts/BxTemplCmtsMenuUnitMeta.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxDolMenu
+ */
+class BxTemplCmtsMenuUnitMeta extends BxBaseCmtsMenuUnitMeta
+{
+    public function __construct ($aObject, $oTemplate = false)
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+}
+
+/** @} */

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

@@ -2301,6 +2301,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_menu_set_title_add_profile"><![CDATA[Add Profile]]></string>
 	<string name="_sys_menu_set_title_cmts_item_actions"><![CDATA[Comment Actions]]></string>
 	<string name="_sys_menu_set_title_cmts_item_manage"><![CDATA[Manage Comment]]></string>
+        <string name="_sys_menu_set_title_cmts_item_meta"><![CDATA[Comment Meta Info]]></string>
 	<string name="_sys_menu_set_title_switch_language"><![CDATA[Switch Language]]></string>
 	<string name="_sys_menu_set_title_switch_template"><![CDATA[Switch Template]]></string>
 	<string name="_sys_menu_set_title_sys_social_sharing"><![CDATA[Social Sharing]]></string>
@@ -2345,6 +2346,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_menu_title_add_profile_vertical"><![CDATA[Add Profile Menu (vertical)]]></string>
 	<string name="_sys_menu_title_cmts_item_actions"><![CDATA[Comment Actions]]></string>
 	<string name="_sys_menu_title_cmts_item_manage"><![CDATA[Manage Comment]]></string>
+        <string name="_sys_menu_title_cmts_item_meta"><![CDATA[Comment Meta Info]]></string>
 	<string name="_sys_menu_title_footer"><![CDATA[Footer Links]]></string>
 	<string name="_sys_menu_title_main"><![CDATA[Site Navigation]]></string>
 	<string name="_sys_menu_title_homepage"><![CDATA[Homepage Menu]]></string>

+ 2 - 2
modules/boonex/ocean/data/template/system/css/cmts.css

@@ -1,5 +1,5 @@
 @import url(../../../../../../../template/css/cmts.css);
 
-div.cmt-head .cmt-username {
-	font-weight: bold;
+div.cmt-head .cmt-meta-username {
+    font-weight: bold;
 }

+ 21 - 0
modules/boonex/ocean/data/template/system/scripts/BxTemplCmtsMenuUnitMeta.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxDolMenu
+ */
+class BxTemplCmtsMenuUnitMeta extends BxBaseCmtsMenuUnitMeta
+{
+    public function __construct ($aObject, $oTemplate = false)
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 21 - 0
modules/boonex/protean/data/template/system/scripts/BxTemplCmtsMenuUnitMeta.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxDolMenu
+ */
+class BxTemplCmtsMenuUnitMeta extends BxBaseCmtsMenuUnitMeta
+{
+    public function __construct ($aObject, $oTemplate = false)
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+}
+
+/** @} */

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

@@ -2298,6 +2298,7 @@
 	<string name="_sys_menu_set_title_add_profile"><![CDATA[Добавить профиль]]></string>
 	<string name="_sys_menu_set_title_cmts_item_actions"><![CDATA[Комментарий - Действия]]></string>
 	<string name="_sys_menu_set_title_cmts_item_manage"><![CDATA[Комментарий - Управление]]></string>
+        <string name="_sys_menu_set_title_cmts_item_meta"><![CDATA[Комментарий - Мета инфо]]></string>
 	<string name="_sys_menu_set_title_switch_language"><![CDATA[Переключить язык]]></string>
 	<string name="_sys_menu_set_title_switch_template"><![CDATA[Переключить тему]]></string>
 	<string name="_sys_menu_set_title_sys_social_sharing"><![CDATA[Социальные сети]]></string>
@@ -2342,6 +2343,7 @@
 	<string name="_sys_menu_title_add_profile_vertical"><![CDATA[Добавить профиль - Меню вертикальное]]></string>
 	<string name="_sys_menu_title_cmts_item_actions"><![CDATA[Комментарий - Действия]]></string>
 	<string name="_sys_menu_title_cmts_item_manage"><![CDATA[Комментарий - Управление]]></string>
+        <string name="_sys_menu_title_cmts_item_meta"><![CDATA[Комментарий - Мета инфо]]></string>
 	<string name="_sys_menu_title_footer"><![CDATA[Основание - Ссылки]]></string>
 	<string name="_sys_menu_title_main"><![CDATA[Сайт - Навигация]]></string>
 	<string name="_sys_menu_title_homepage"><![CDATA[Меню на главной странице]]></string>

+ 24 - 37
template/comment.html

@@ -1,39 +1,26 @@
 <li id="cmt__id__" class="__style_prefix____class__ bx-def-padding-top bx-def-margin-bottom">
-	<div class="__style_prefix__-cnt__class_cnt__">
-		<div class="__style_prefix__-blink-plate"></div>
-		<div class="__style_prefix__-avatar bx-def-thumb-size">__author_unit__</div>
-		<div class="__style_prefix__-info bx-def-thumb-size-min-height bx-def-thumb-size-left-indent">
-			<div class="__style_prefix__-head bx-clearfix">
-				<bx_if:show_reply_to>
-					<span class="__style_prefix__-reply-to">
-						<a href="__par_cmt_link__" title="__par_cmt_title__"><i class="sys-icon reply"></i></a>
-					</span>
-				</bx_if:show_reply_to>
-				<span class="__style_prefix__-username">
-					<bx_if:show_author_link><a href="__author_link__" title="__author_title__">__author_name__</a> </bx_if:show_author_link>
-					<bx_if:show_author_text>__author_name__ </bx_if:show_author_text>
-				</span>
-			</div>
-			<div class="__style_prefix__-subhead bx-def-font-small bx-clearfix">
-				<div class="__style_prefix__-ago">
-					<bx_if:show_ago_link>
-						<a class="__style_prefix__-ago" href="__view_link__" rel="nofollow">__ago__</a>
-					</bx_if:show_ago_link>
-					<bx_if:show_ago_text>__ago__</bx_if:show_ago_text>
-				</div>
-			</div>
-			<div class="__style_prefix__-cont bx-def-margin-sec-topbottom">
-				<div class="__style_prefix__-cont-cnt">
-					<div class="__style_prefix__-body">
-						__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more>
-					</div>
-					<bx_if:show_attached>
-						<div class="__style_prefix__-attached bx-def-margin-thd-leftright-neg bx-clearfix">__attached__</div>
-					</bx_if:show_attached>
-				</div>
-			</div>
-			__actions__
-		</div>
-	</div>
-	<ul class="cmts cmts-margin">__replies__</ul>
+    <div class="__style_prefix__-cnt__class_cnt__">
+        <div class="__style_prefix__-blink-plate"></div>
+        <div class="__style_prefix__-avatar bx-def-thumb-size">__author_unit__</div>
+        <div class="__style_prefix__-info bx-def-thumb-size-min-height bx-def-thumb-size-left-indent">
+            <div class="__style_prefix__-head bx-clearfix">
+                <bx_if:show_reply_to>
+                    <span class="__style_prefix__-reply-to">
+                        <a href="__par_cmt_link__" title="__par_cmt_title__"><i class="sys-icon reply"></i></a>
+                    </span>
+                </bx_if:show_reply_to>
+                <bx_if:meta><span class="__style_prefix__-meta">__meta__</span></bx_if:meta>
+            </div>
+            <div class="__style_prefix__-cont bx-def-margin-sec-topbottom">
+                <div class="__style_prefix__-cont-cnt">
+                    <div class="__style_prefix__-body">__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more></div>
+                    <bx_if:show_attached>
+                        <div class="__style_prefix__-attached bx-def-margin-thd-leftright-neg bx-clearfix">__attached__</div>
+                    </bx_if:show_attached>
+                </div>
+            </div>
+            __actions__
+        </div>
+    </div>
+    <ul class="cmts cmts-margin">__replies__</ul>
 </li>

+ 28 - 3
template/css/cmts.css

@@ -93,8 +93,7 @@
     	background-color: rgb(255, 244, 213);
     	background-color: rgba(255, 234, 193, 0.5);
     }
-	div.cmt-head,
-	div.cmt-subhead {
+	div.cmt-head {
 		text-align: left;
     	text-overflow: ellipsis;
 		white-space: nowrap;
@@ -110,6 +109,32 @@
         text-transform: lovercase;
     }
 
+    /*--- unit meta ---*/
+    .cmt-meta {
+        white-space: nowrap;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        text-align: left;
+    }
+    .cmt-meta ul.bx-menu-custom.bx-menu-hor > li > span {
+            margin-right: 0;
+    }
+    .cmt-meta ul.bx-menu-custom li:first-child .cmt-meta-div {
+        display: none;
+    }
+    .cmt-meta ul.bx-menu-custom li .cmt-meta-item,
+    .cmt-meta ul.bx-menu-custom li .cmt-meta-div,
+    .cmt-meta ul.bx-menu-custom li .bx-btn {
+        position: relative;
+        float: none;
+        display: inline-block;
+        vertical-align: middle;
+    }
+    .cmt-meta ul.bx-menu-custom li .cmt-meta-item .cmt-meta-ago {
+        font-size: 12px;
+        font-size: .75rem;
+    }
+
     /*--- Comment Body ---*/
     div.cmt-cont {
         position: relative;
@@ -158,7 +183,7 @@
 		position: relative;
 		text-align: left;
 	}
-	div.cmt-ago,
+	div.cmt-meta-ago,
 	div.cmt-comment-manage-link, 
 	div.cmt-actions ul.bx-menu-hor,
 	div.cmt-points-wrp {

+ 16 - 15
template/scripts/BxBaseCmts.php

@@ -257,8 +257,19 @@ class BxBaseCmts extends BxDolCmts
             $sReplies = $this->getComments(array('parent_id' => $aCmt['cmt_id'], 'vparent_id' => $aCmt['cmt_id'], 'type' => $aBp['type']), $aDp);
         }
 
-		$sAgo = bx_time_js($aCmt['cmt_time']);
-        $bObjectTitle = !empty($this->_aSystem['trigger_field_title']);
+        $aTmplVarsMeta = array();
+        if(!empty($this->_sMenuObjMeta)) {
+            $oMenuMeta = BxDolMenu::getObjectInstance($this->_sMenuObjMeta, $this->_oTemplate);
+            if($oMenuMeta) {
+                $oMenuMeta->setCmtsData($this, $aCmt['cmt_id']);
+
+                $aTmplVarsMeta = array(
+                    'style_prefix' => $this->_sStylePrefix,
+                    'meta' => $oMenuMeta->getCode()
+                );
+            }
+        }
+
         return $this->_oTemplate->parseHtmlByName('comment.html', array_merge(array(
             'system' => $this->_sSystem,
             'style_prefix' => $this->_sStylePrefix,
@@ -271,19 +282,9 @@ class BxBaseCmts extends BxDolCmts
                 'condition' => !empty($aTmplReplyTo),
                 'content' => $aTmplReplyTo
             ),
-            'bx_if:show_ago_link' => array(
-                'condition' => $bObjectTitle,
-                'content' => array(
-                    'style_prefix' => $this->_sStylePrefix,
-                    'view_link' => $this->getViewUrl($aCmt['cmt_id']),
-                    'ago' => $sAgo
-                )
-            ),
-            'bx_if:show_ago_text' => array(
-                'condition' => !$bObjectTitle,
-                'content' => array(
-                    'ago' => $sAgo
-                )
+            'bx_if:meta' => array(
+                'condition' => !empty($aTmplVarsMeta),
+                'content' => $aTmplVarsMeta
             ),
             'bx_if:show_attached' => array(
                 'condition' => !empty($sAttachments),

+ 76 - 0
template/scripts/BxBaseCmtsMenuUnitMeta.php

@@ -0,0 +1,76 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaBaseView UNA Base Representation Classes
+ * @{
+ */
+
+/**
+ * Menu representation.
+ * @see BxDolMenu
+ */
+class BxBaseCmtsMenuUnitMeta extends BxTemplMenuUnitMeta
+{
+    protected $_oCmts;
+    protected $_aCmtsSystem;
+    protected $_aCmt;
+
+    public function __construct ($aObject, $oTemplate)
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+
+    public function setCmtsData($oCmts, $iCmtId)
+    {
+        if(empty($oCmts) || empty($iCmtId))
+            return;
+
+        $this->_oCmts = $oCmts;
+        $this->_aCmtsSystem = $oCmts->getSystemInfo();
+        $this->_aCmt = $oCmts->getCommentRow($iCmtId);
+
+        $this->_sStylePrefix = (!empty($this->_aCmtsSystem['root_style_prefix']) ? $this->_aCmtsSystem['root_style_prefix'] : 'cmt') . '-meta';
+
+        $this->addMarkers(array(
+            'cmt_system' => $this->_oCmts->getSystemName(),
+            'cmt_object_id' => $this->_oCmts->getId(),
+            'cmt_id' => $iCmtId,
+            'content_id' => $iCmtId,
+        ));
+    }
+
+    protected function _getMenuItemAuthor($aItem)
+    {
+        list($sAuthorName, $sAuthorLink, $sAuthorIcon, $sAuthorUnit) = $this->_oCmts->getAuthorInfo($this->_aCmt['cmt_author_id']);
+
+        if(!empty($sAuthorLink))
+            return $this->getUnitMetaItemLink($sAuthorName, array(
+                'href' => $sAuthorLink,
+                'class' => $this->_sStylePrefix . '-username',
+                'title' => bx_html_attribute($sAuthorName),
+            ));
+        else
+            return $this->getUnitMetaItemText($sAuthorName, array(
+                'class' => $this->_sStylePrefix . '-username'
+            ));
+    }
+    
+    protected function _getMenuItemDate($aItem)
+    {
+        $sAgo = bx_time_js($this->_aCmt['cmt_time']);
+
+        if(!empty($this->_aCmtsSystem['trigger_field_title']))
+            return $this->getUnitMetaItemLink($sAgo, array(
+                'href' => $this->_oCmts->getViewUrl($this->_aCmt['cmt_id']),
+                'class' => $this->_sStylePrefix . '-ago'
+            ));
+        else
+            return $this->getUnitMetaItemText($sAgo, array(
+                'class' => $this->_sStylePrefix . '-ago'
+            ));
+    }
+}
+
+/** @} */