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

+ 1 - 0
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -135,6 +135,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 
         	'menu_item_manage' => $this->_sName . '_menu_item_manage',
         	'menu_item_actions' => $this->_sName . '_menu_item_actions',
+                'menu_item_meta' => $this->_sName . '_menu_item_meta',
         	'menu_post_attachments' => $this->_sName . '_menu_post_attachments',
 
         	'form_post' => $this->_sName . '_post',

+ 54 - 0
modules/boonex/timeline/classes/BxTimelineMenuSnippetMeta.php

@@ -0,0 +1,54 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Timeline Timeline
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+class BxTimelineMenuSnippetMeta extends BxBaseModTextMenuSnippetMeta
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_timeline';
+
+        parent::__construct($aObject, $oTemplate);
+
+        $this->_sStylePrefix = $this->_oModule->_oConfig->getPrefix('style') . '-item-meta';
+    }
+
+    public function setEvent($aEvent)
+    {
+        if(empty($aEvent) || !is_array($aEvent))
+            return;
+
+        $this->_aContentInfo = $aEvent;
+        $this->_iContentId = (int)$aEvent['id'];
+    }
+
+    protected function _getMenuItemDate($aItem)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        return $this->getUnitMetaItemLink(bx_time_js($this->_aContentInfo[$CNF['FIELD_ADDED']], BX_FORMAT_DATE), array(
+            'href' => $this->_oModule->_oConfig->getItemViewUrl($this->_aContentInfo),
+            'class' => $this->_sStylePrefix . '-date bx-base-text-unit-date'
+        ));
+    }
+
+    protected function _getMenuItemMembership($aItem)
+    {
+        $aMembership = BxDolAcl::getInstance()->getMemberMembershipInfo($this->_aContentInfo['object_owner_id']);
+        if(empty($aMembership) || !is_array($aMembership))
+            return '';
+
+        return $this->getUnitMetaItemText(_t($aMembership['name']), array(
+            'class' => $this->_sStylePrefix . '-membership'
+        ));
+    }
+}
+
+/** @} */

+ 1 - 1
modules/boonex/timeline/classes/BxTimelineSearchResult.php

@@ -21,7 +21,7 @@ class BxTimelineSearchResult extends BxBaseModNotificationsSearchResult
             'object_metatags' => 'bx_timeline',
             'title' => _t('_bx_timeline_page_title_browse'),
             'table' => 'bx_timeline_events',
-            'ownFields' => array('id', 'owner_id', 'type', 'action', 'object_id', 'object_privacy_view', 'content', 'title', 'description', 'views', 'rate', 'votes', 'score', 'sc_up', 'sc_down', 'comments', 'reports', 'reposts', 'date', 'active', 'hidden', 'pinned', 'promoted'),
+            'ownFields' => array('id', 'owner_id', 'type', 'action', 'object_id', 'object_privacy_view', 'content', 'title', 'description', 'views', 'rate', 'votes', 'score', 'sc_up', 'sc_down', 'comments', 'reports', 'reposts', 'date', 'active', 'hidden', 'pinned', 'sticked', 'promoted'),
             'searchFields' => array('title', 'description'),
             'restriction' => array(
                 'internal' => array('value' => 'timeline_common_post', 'field' => 'type', 'operator' => '='),

+ 20 - 0
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -942,6 +942,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 
         $aTmplVarsNote = $this->_getTmplVarsNote($aEvent);
         $aTmplVarsMenuItemActions = $this->_getTmplVarsMenuItemActions($aEvent, $aBrowseParams);
+        $aTmplVarsMenuItemMeta = $this->_getTmplVarsMenuItemMeta($aEvent, $aBrowseParams);
 
         $aTmplVarsOwnerActions = $this->_getTmplVarsOwnerActions($aEvent);
         $bTmplVarsOwnerActions = !empty($aTmplVarsOwnerActions); 
@@ -1051,6 +1052,10 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                 'condition' => !empty($aTmplVarsMenuItemActions),
                 'content' => $aTmplVarsMenuItemActions
             ),
+            'bx_if:show_menu_item_meta' => array(
+                'condition' => !empty($aTmplVarsMenuItemMeta),
+                'content' => $aTmplVarsMenuItemMeta
+            ),
             'comments' => '',
         );
 
@@ -1129,6 +1134,21 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         );
     }
 
+    protected function _getTmplVarsMenuItemMeta(&$aEvent, $aBrowseParams = array())
+    {
+        $oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_meta'));
+        $oMenu->setEvent($aEvent);
+
+        $sMenu = $oMenu->getCode();
+        if(empty($sMenu))
+            return array();
+
+        return array(
+            'style_prefix' => $this->_oConfig->getPrefix('style'),
+            'meta' => $sMenu
+        );
+    }
+
     protected function _getTmplVarsTimelineOwner(&$aEvent)
     {
         $iOwnerId = (int)$aEvent['owner_id'];

+ 1 - 1
modules/boonex/timeline/install/sql/disable.sql

@@ -6,7 +6,7 @@ DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_timeline' OR `object` IN('bx
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_timeline';
 DELETE FROM `sys_menu_sets` WHERE `module` = 'bx_timeline';
-DELETE FROM `sys_menu_items` WHERE `module` = 'bx_timeline' OR `set_name` IN('bx_timeline_menu_item_share', 'bx_timeline_menu_item_manage', 'bx_timeline_menu_item_actions', 'bx_timeline_menu_post_attachments');
+DELETE FROM `sys_menu_items` WHERE `module` = 'bx_timeline' OR `set_name` IN('bx_timeline_menu_item_share', 'bx_timeline_menu_item_manage', 'bx_timeline_menu_item_actions', 'bx_timeline_menu_item_meta', 'bx_timeline_menu_post_attachments');
 
 
 -- SETTINGS

+ 12 - 0
modules/boonex/timeline/install/sql/enable.sql

@@ -107,6 +107,18 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_timeline_menu_item_actions', 'bx_timeline', 'item-share', '_bx_timeline_menu_item_title_system_item_share', '_bx_timeline_menu_item_title_item_share', 'javascript:void(0)', 'bx_menu_popup(''bx_timeline_menu_item_share'', this, {''id'':''bx_timeline_menu_item_share_{content_id}''}, {content_id:{content_id}});', '', 'share-alt', '', 'bx_timeline_menu_item_share', 1, 2147483647, 1, 0, 1, 4),
 ('bx_timeline_menu_item_actions', 'bx_timeline', 'item-more', '_bx_timeline_menu_item_title_system_item_more', '_bx_timeline_menu_item_title_item_more', 'javascript:void(0)', 'bx_menu_popup(''bx_timeline_menu_item_manage'', this, {''id'':''bx_timeline_menu_item_manage_{content_id}''}, {content_id:{content_id}, type:''{type}'', view:''{view}''});', '', 'ellipsis-h', '', 'bx_timeline_menu_item_manage', 1, 2147483647, 1, 0, 1, 5);
 
+-- MENU: Item Meta Info
+INSERT INTO `sys_objects_menu` (`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
+('bx_timeline_menu_item_meta', '_sys_menu_title_snippet_meta', 'bx_timeline_menu_item_meta', 'bx_timeline', 15, 0, 1, 'BxTimelineMenuSnippetMeta', 'modules/boonex/timeline/classes/BxTimelineMenuSnippetMeta.php');
+
+INSERT INTO `sys_menu_sets` (`set_name`, `module`, `title`, `deletable`) VALUES
+('bx_timeline_menu_item_meta', 'bx_timeline', '_sys_menu_set_title_snippet_meta', 0);
+
+-- 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 
+('bx_timeline_menu_item_meta', 'bx_timeline', 'date', '_sys_menu_item_title_system_sm_date', '_sys_menu_item_title_sm_date', '', '', '', '', '', '', 0, 2147483647, 1, 0, 1, 1),
+('bx_timeline_menu_item_meta', 'bx_timeline', 'membership', '_sys_menu_item_title_system_sm_membership', '_sys_menu_item_title_sm_membership', '', '', '', '', '', '', 0, 2147483647, 0, 0, 1, 2);
+
 -- MENU: Post form attachments (Link, Photo, Video)
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_timeline_menu_post_attachments', '_bx_timeline_menu_title_post_attachments', 'bx_timeline_menu_post_attachments', 'bx_timeline', 9, 0, 1, '', '');

+ 21 - 0
modules/boonex/timeline/template/css/view.css

@@ -136,6 +136,27 @@ div.bx-tl-item div.bx-tl-owner-actions .bx-btn {
 	vertical-align: middle;
 }
 
+/*--- Item Meta Info Style ---*/
+.bx-tl-item-meta {
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    text-align: left;
+}
+.bx-tl-item-meta ul.bx-menu-custom.bx-menu-hor > li > span {
+        margin-right: 0;
+}
+.bx-tl-item-meta ul.bx-menu-custom li:first-child .bx-tl-item-meta-div {
+    display: none;
+}
+.bx-tl-item-meta ul.bx-menu-custom li .bx-tl-item-meta-item,
+.bx-tl-item-meta ul.bx-menu-custom li .bx-tl-item-meta-div,
+.bx-tl-item-meta ul.bx-menu-custom li .bx-btn {
+    position: relative;
+    float: none;
+    display: inline-block;
+    vertical-align: middle;
+}
 
 /*--- Item Content Style ---*/
 div.bx-tl-item-content {

+ 30 - 27
modules/boonex/timeline/template/item_outline.html

@@ -10,33 +10,36 @@
 	            </div>
 	        </bx_if:show_note>
 	    	<div class="__style_prefix__-item-owner bx-def-margin-leftright __class_owner__"> 
-		       	<div class="__style_prefix__-owner-avatar bx-def-thumb-size">__item_owner_unit__</div>
-				<div class="__style_prefix__-owner-info bx-def-thumb-size-min-height bx-def-thumb-size-left-indent">
-				    <!-- NOTE: Spaces after and between elements in 'owner-name' DIV are needed for better line folding -->
-					<div class="__style_prefix__-owner-name bx-def-font-middle bx-def-font-light bx-def-font-grayed">
-						<a href="__item_owner_url__" class="__style_prefix__-owner-name" title="__item_owner_title__">__item_owner_name__</a> 
-			            <bx_if:show_timeline_owner>
-				        	<i class="sys-icon caret-right"></i> <a href="__owner_url__" class="__style_prefix__-timeline-owner-name">__owner_username__</a> 
-				        </bx_if:show_timeline_owner>
-				        <span class="bx-def-font-small"> __item_owner_action__ </span> <span class="bx-bullet-narrow"> </span><a class="__style_prefix__-date bx-base-text-unit-date bx-def-font-small" href="__item_view_url__"> __item_date__ </a> 
-                        <bx_if:show_pinned>
-                            <span class="__style_prefix__-pinned bx-def-margin-thd-left">
-                                <i class="sys-icon thumbtack bx-def-margin-thd-left" title="<bx_text_attribute:_bx_timeline_txt_pinned />"></i>
-                            </span>
-                        </bx_if:show_pinned>
-                        <bx_if:show_sticked>
-                            <span class="__style_prefix__-sticked bx-def-margin-thd-left">
-                                <i class="sys-icon thumbtack bx-def-margin-thd-left" title="<bx_text_attribute:_bx_timeline_txt_sticked />"></i>
-                            </span>
-                        </bx_if:show_sticked>
-                        <bx_if:show_hot>
-	                        <span class="__style_prefix__-hot bx-def-margin-thd-left">
-	                            <i class="sys-icon fire bx-def-margin-thd-left" title="<bx_text_attribute:_bx_timeline_txt_hot />"></i>
-	                        </span>
-	                    </bx_if:show_hot>
-					</div>
-				</div>
-				<bx_if:show_owner_actions>
+                    <div class="__style_prefix__-owner-avatar bx-def-thumb-size">__item_owner_unit__</div>
+                        <div class="__style_prefix__-owner-info bx-def-thumb-size-min-height bx-def-thumb-size-left-indent">
+                            <!-- NOTE: Spaces after and between elements in 'owner-name' DIV are needed for better line folding -->
+                            <div class="__style_prefix__-owner-name bx-def-font-middle bx-def-font-light bx-def-font-grayed">
+                                <a href="__item_owner_url__" class="__style_prefix__-owner-name" title="__item_owner_title__">__item_owner_name__</a> 
+                                <bx_if:show_timeline_owner>
+                                    <i class="sys-icon caret-right"></i> <a href="__owner_url__" class="__style_prefix__-timeline-owner-name">__owner_username__</a> 
+                                </bx_if:show_timeline_owner>
+                                <span class="bx-def-font-small"> __item_owner_action__ </span> 
+                                <bx_if:show_menu_item_meta>
+                                    <span class="__style_prefix__-item-meta bx-def-font-small">__meta__</span>
+                                </bx_if:show_menu_item_meta>
+                                <bx_if:show_pinned>
+                                    <span class="__style_prefix__-pinned bx-def-margin-thd-left">
+                                        <i class="sys-icon thumbtack bx-def-margin-thd-left" title="<bx_text_attribute:_bx_timeline_txt_pinned />"></i>
+                                    </span>
+                                </bx_if:show_pinned>
+                                <bx_if:show_sticked>
+                                    <span class="__style_prefix__-sticked bx-def-margin-thd-left">
+                                        <i class="sys-icon thumbtack bx-def-margin-thd-left" title="<bx_text_attribute:_bx_timeline_txt_sticked />"></i>
+                                    </span>
+                                </bx_if:show_sticked>
+                                <bx_if:show_hot>
+                                    <span class="__style_prefix__-hot bx-def-margin-thd-left">
+                                        <i class="sys-icon fire bx-def-margin-thd-left" title="<bx_text_attribute:_bx_timeline_txt_hot />"></i>
+                                    </span>
+                                </bx_if:show_hot>
+                            </div>
+                        </div>
+                        <bx_if:show_owner_actions>
 	                <div class="__style_prefix__-owner-actions bx-def-thumb-size-min-height">
 	                    <bx_repeat:owner_actions>
 	                        <a class="bx-btn bx-btn-small" href="__href__" onclick="__onclick__" title="__title__"><i class="sys-icon __icon__"></i></a>

+ 4 - 1
modules/boonex/timeline/template/item_search.html

@@ -9,7 +9,10 @@
                     <bx_if:show_timeline_owner>
                         <i class="sys-icon caret-right"></i> <a href="__owner_url__" class="__style_prefix__-timeline-owner-name">__owner_username__</a> 
                     </bx_if:show_timeline_owner>
-                    <span class="bx-def-font-small"> __item_owner_action__ </span> <span class="bx-bullet-narrow"> </span><a class="__style_prefix__-date bx-base-text-unit-date bx-def-font-small" href="__item_view_url__"> __item_date__ </a> 
+                    <span class="bx-def-font-small"> __item_owner_action__ </span> 
+                    <bx_if:show_menu_item_meta>
+                        <span class="__style_prefix__-item-meta bx-def-font-small">__meta__</span>
+                    </bx_if:show_menu_item_meta>
                     <bx_if:show_pinned>
                         <span class="__style_prefix__-pinned bx-def-margin-thd-left">
                             <i class="sys-icon thumbtack bx-def-margin-thd-left" title="<bx_text_attribute:_bx_timeline_txt_pinned />"></i>

+ 3 - 1
modules/boonex/timeline/template/item_timeline.html

@@ -23,7 +23,9 @@
                         <i class="sys-icon caret-right"></i> <a href="__owner_url__" class="__style_prefix__-timeline-owner-name">__owner_username__</a> 
                     </bx_if:show_timeline_owner>
                     <span class="bx-def-font-small"> __item_owner_action__ </span><br /> 
-                    <a class="__style_prefix__-date bx-base-text-unit-date bx-def-font-small" href="__item_view_url__"> __item_date__ </a> 
+                    <bx_if:show_menu_item_meta>
+                        <span class="__style_prefix__-item-meta bx-def-font-small">__meta__</span>
+                    </bx_if:show_menu_item_meta>
                     <bx_if:show_pinned>
                         <span class="__style_prefix__-pinned bx-def-margin-thd-left">
                             <i class="sys-icon thumbtack bx-def-margin-thd-left" title="<bx_text_attribute:_bx_timeline_txt_pinned />"></i>