Quellcode durchsuchen

#24 - Timeline.
1. New Inline menu.
2. Convert hardcoded menus into builder based.

AntonLV vor 13 Jahren
Ursprung
Commit
9b6149842c

+ 3 - 1
install/sql/v70.sql

@@ -2835,7 +2835,9 @@ INSERT INTO `sys_menu_templates` (`id`, `template`, `title`) VALUES
 (6, 'menu_vertical.html', '_sys_menu_template_title_ver'),
 (7, 'menu_floating_blocks.html', '_sys_menu_template_title_floating_blocks'),
 (8, 'menu_main_submenu.html', '_sys_menu_template_title_main_submenu'),
-(9, 'menu_buttons_hor.html', '_sys_menu_template_title_buttons_hor');
+(9, 'menu_buttons_hor.html', '_sys_menu_template_title_buttons_hor'),
+(10, 'menu_inline.html', '_sys_menu_template_title_inline'),
+(11, 'menu_interactive_vertical.html', '_sys_menu_template_title_interactive_vertical');
 
 CREATE TABLE IF NOT EXISTS `sys_objects_menu` (
   `id` int(11) NOT NULL AUTO_INCREMENT,

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

@@ -3373,6 +3373,8 @@ More info about URI DNSBL: <br />
     <string name="_sys_menu_template_title_toolbar"><![CDATA[Toolbar Buttons]]></string>
     <string name="_sys_menu_template_title_floating_blocks"><![CDATA[Floating Blocks]]></string>
     <string name="_sys_menu_template_title_buttons_hor"><![CDATA[Horizontal Buttons]]></string>
+    <string name="_sys_menu_template_title_inline"><![CDATA[Inline]]></string>
+    <string name="_sys_menu_template_title_interactive_vertical"><![CDATA[Interactive Vertical Links]]></string>
 
     <string name="_sys_designbox_0"><![CDATA[Content only]]></string>
     <string name="_sys_designbox_1"><![CDATA[Content + title + background]]></string>

+ 0 - 10
modules/boonex/timeline/classes/BxTimelineCmts.php

@@ -22,16 +22,6 @@ class BxTimelineCmts extends BxTemplCmtsView
     {
     	return false;
     }
-
-	public function isPostReplyAllowed ($isPerformAction = false)
-	{
-		bx_import('BxDolModule');
-		$oModule = BxDolModule::getInstance('bx_timeline');
-		if(!$oModule->isAllowedComment($isPerformAction))
-			return false;
-
-        return parent::isPostReplyAllowed($isPerformAction);
-    }
 }
 
 /** @} */ 

+ 17 - 5
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -34,9 +34,12 @@ class BxTimelineConfig extends BxDolModuleConfig
     protected $_sTranscoderObjectPreview;
     protected $_aImageUploaders;
 
-    protected $_sConnObjFriends;
 	protected $_sConnObjSubscriptions;
 
+	protected $_sMenuPost;
+	protected $_sMenuItemManage;
+	protected $_sMenuItemActions;
+
     protected $_bJsMode;
     protected $_aJsClass;
     protected $_aJsObjects;
@@ -65,9 +68,12 @@ class BxTimelineConfig extends BxDolModuleConfig
         $this->_sTranscoderObjectPreview = 'bx_timeline_photos_preview';
         $this->_aImageUploaders = array('bx_timeline_simple');        
 
-        $this->_sConnObjFriends = 'sys_profiles_friends';
 		$this->_sConnObjSubscriptions = 'sys_profiles_subscriptions';
 
+		$this->_sMenuPost = 'bx_timeline_menu_post';
+		$this->_sMenuItemManage = 'bx_timeline_menu_item_manage';
+		$this->_sMenuItemActions = 'bx_timeline_menu_item_actions';
+
         $this->_bJsMode = false;
         $this->_aJsClass = array(
         	'main' => 'BxTimelineMain',
@@ -168,12 +174,18 @@ class BxTimelineConfig extends BxDolModuleConfig
     		case 'transcoder_preview':
     			$sResult = $this->_sTranscoderObjectPreview;
     			break;
-    		case 'conn_friends':
-    			$sResult = $this->_sConnObjFriends;
-    			break;
     		case 'conn_subscriptions':
     			$sResult = $this->_sConnObjSubscriptions;
     			break;
+    		case 'menu_post':
+    			$sResult = $this->_sMenuPost;
+    			break;
+    		case 'menu_item_manage':
+    			$sResult = $this->_sMenuItemManage;
+    			break;
+    		case 'menu_item_actions':
+    			$sResult = $this->_sMenuItemActions;
+    			break;
     	}
 
         return $sResult;

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

@@ -221,7 +221,7 @@ class BxTimelineDb extends BxDolModuleDb
 
 						case BX_TIMELINE_TYPE_CONNECTIONS:
 							bx_import('BxDolConnection');
-							$oConnection = BxDolConnection::getObjectInstance($this->_oConfig->getObject('conn_friends'));
+							$oConnection = BxDolConnection::getObjectInstance($this->_oConfig->getObject('conn_subscriptions'));
 		
 							$aQueryParts = $oConnection->getConnectedContentAsSQLParts($this->_sPrefix . "events", 'owner_id', $aParams['owner_id']);
 							$sJoinClause .= ' ' . $aQueryParts['join'];

+ 81 - 0
modules/boonex/timeline/classes/BxTimelineMenuItem.php

@@ -0,0 +1,81 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    Persons Persons
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
+
+bx_import('BxTemplMenu');
+
+/**
+ * 'Item' menu.
+ */
+class BxTimelineMenuItem extends BxTemplMenu {
+	protected $_aEvent;
+    protected $_oModule;
+
+    public function __construct($aObject, $oTemplate = false) {
+        parent::__construct($aObject, $oTemplate);
+
+        $this->_oModule = BxDolModule::getInstance('bx_timeline');
+
+        $this->addMarkers(array(
+        	'js_object_view' => $this->_oModule->_oConfig->getJsObject('view'),
+        ));
+    }
+
+    public function setEvent($aEvent)
+    {
+    	if(empty($aEvent) || !is_array($aEvent))
+    		return;
+
+    	$this->_aEvent = $aEvent;
+    	
+    	$sCommentsSystem = '';
+    	if(isset($aEvent['comments']) && is_array($aEvent['comments']) && isset($aEvent['comments']['system']))
+    		$sCommentsSystem = $aEvent['comments']['system'];
+
+    	$this->addMarkers(array(
+			'content_id' => $aEvent['id'],
+			'comments_system' => $sCommentsSystem
+		));    	
+    }
+
+    /**
+     * Check if menu items is visible.
+     * @param $a menu item array
+     * @return boolean
+     */ 
+    protected function _isVisible ($a) {
+        if(!parent::_isVisible($a))
+        	return false;
+
+		$sCheckFuncName = '';
+        $aCheckFuncParams = array();
+        switch ($a['name']) {
+            case 'item-delete':
+                $sCheckFuncName = 'isAllowedDelete';
+                if(!empty($this->_aEvent))
+                	$aCheckFuncParams = array($this->_aEvent);
+                break;
+
+			case 'item-comment':
+                $sCheckFuncName = 'isAllowedComment';
+                if(!empty($this->_aEvent))
+                	$aCheckFuncParams = array($this->_aEvent);
+                break;
+        }
+
+        if(!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName))
+			return true;
+
+		return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams);
+    }
+
+}
+
+/** @} */

+ 62 - 0
modules/boonex/timeline/classes/BxTimelineMenuPost.php

@@ -0,0 +1,62 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    Persons Persons
+ * @ingroup     DolphinModules
+ *
+ * @{
+ */
+
+bx_import('BxTemplMenuInteractive');
+
+/**
+ * 'Item' menu.
+ */
+class BxTimelineMenuPost extends BxTemplMenuInteractive {
+    protected $_oModule;
+
+    public function __construct($aObject, $oTemplate = false) {
+        parent::__construct($aObject, $oTemplate);
+
+        $this->_oModule = BxDolModule::getInstance('bx_timeline');
+
+        $this->addMarkers(array(
+        	'js_object_post' => $this->_oModule->_oConfig->getJsObject('post'),
+        ));
+    }
+
+    public function setMenuId($sMenuId)
+    {
+    	$this->_aObject['menu_id'] = $sMenuId;
+    }
+
+    /**
+     * Check if menu items is visible.
+     * @param $a menu item array
+     * @return boolean
+     */ 
+    protected function _isVisible ($a) {
+        if(!parent::_isVisible($a))
+        	return false;
+
+		$sCheckFuncName = '';
+        $aCheckFuncParams = array();
+        switch ($a['name']) {
+            case 'post-text':
+            case 'post-link':
+            case 'post-photo':
+                $sCheckFuncName = 'isAllowedPost';
+                break;
+        }
+
+        if(!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName))
+			return true;
+
+		return call_user_func_array(array($this->_oModule, $sCheckFuncName), $aCheckFuncParams);
+    }
+
+}
+
+/** @} */

+ 32 - 24
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -237,21 +237,10 @@ class BxTimelineModule extends BxDolModule
         if($this->_iOwnerId != $this->getUserId() && !$this->isAllowedPost())
             return array();
 
-		$sJsObject = $this->_oConfig->getJsObject('post');
-        $aMenu = array(
-			array('id' => 'timeline-ptype-text', 'name' => 'timeline-ptype-text', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => "javascript:" . $sJsObject . ".changePostType(this, 'text')", 'target' => '_self', 'title' => _t('_bx_timeline_menu_item_write')),
-			array('id' => 'timeline-ptype-link', 'name' => 'timeline-ptype-link', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => "javascript:" . $sJsObject . ".changePostType(this, 'link')", 'target' => '_self', 'title' => _t('_bx_timeline_menu_item_share_link')),
-			array('id' => 'timeline-ptype-photo', 'name' => 'timeline-ptype-photo', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => "javascript:" . $sJsObject . ".changePostType(this, 'photo')", 'target' => '_self', 'title' => _t('_bx_timeline_menu_item_add_photo'))
-        );
-
-        if($this->_oDb->isModule('sounds'))
-            $aMenu[] = array('id' => 'timeline-ptype-sound', 'name' => 'timeline-ptype-sound', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => "javascript:" . $sJsObject . ".changePostType(this, 'sound')", 'target' => '_self', 'title' => _t('_bx_timeline_menu_item_add_music'));
-        if($this->_oDb->isModule('videos'))
-            $aMenu[] = array('id' => 'timeline-ptype-video', 'name' => 'timeline-ptype-video', 'class' => '', 'link' => 'javascript:void(0)', 'onclick' => "javascript:" . $sJsObject . ".changePostType(this, 'video')", 'target' => '_self', 'title' => _t('_bx_timeline_menu_item_add_video'));
-
-		bx_import('BxTemplMenuInteractive');
-		$oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id'=> 'timeline-post-menu', 'menu_items' => $aMenu));
-		$oMenu->setSelected('', 'timeline-ptype-text');
+		bx_import('BxDolMenu');
+		$oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_post'));
+		$oMenu->setMenuId('timeline-post-menu');
+		$oMenu->setSelected($this->getName(), 'post-text');
 
         $sContent = $this->_oTemplate->getPostBlock($this->_iOwnerId);
         return array('content' => $sContent, 'menu' => $oMenu);
@@ -549,30 +538,33 @@ class BxTimelineModule extends BxDolModule
         return $aCheckResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED;
     }
 
-    public function isAllowedDelete($bPerform = false)
+    public function isAllowedDelete($aEvent, $bPerform = false)
     {
         if(isAdmin())
             return true;
 
         $iUserId = (int)$this->getUserId();
-        if($this->_iOwnerId == $iUserId)
+        if((int)$aEvent['owner_id'] == $iUserId)
            return true;
 
         $aCheckResult = checkActionModule($iUserId, 'delete', $this->getName(), $bPerform);
         return $aCheckResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED;
     }
 
-	public function isAllowedComment($bPerform = false)
+	public function isAllowedComment($aEvent, $bPerform = false)
     {
-		if(isAdmin())
-			return true;
+    	$mixedComments = $this->getCommentsData($aEvent);
+    	if($mixedComments === false)
+    		return false;
 
-        $iUserId = $this->getUserId();
-		if($iUserId == 0 && $this->_oConfig->isAllowGuestComments())
+		list($sSystem, $iObjectId) = $mixedComments;
+		$oCmts = $this->getCmtsObject($sSystem, $iObjectId);
+    	$oCmts->addCssJs();
+
+		if(isAdmin())
 			return true;
 
-        $aCheckResult = checkActionModule($iUserId, 'comment', $this->getName(), $bPerform);
-        return $aCheckResult[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED;
+        return $oCmts->isPostReplyAllowed($bPerform);
     }
 
 	public function onPost($iId, $iUserId)
@@ -593,6 +585,22 @@ class BxTimelineModule extends BxDolModule
 		//--- Timeline -> Update for Alerts Engine ---//
     }
 
+    public function getCommentsData(&$aEvent)
+    {
+    	if(empty($aEvent['comments']) || !is_array($aEvent['comments']))
+    		return false; 
+
+    	$aComments = $aEvent['comments'];
+
+		$sSystem = isset($aComments['system']) ? $aComments['system'] : '';
+	    $iObjectId = isset($aComments['object_id']) ? (int)$aComments['object_id'] : 0;
+	    $iCount = isset($aComments['count']) ? (int)$aComments['count'] : 0;
+	    if($sSystem == '' || $iObjectId == 0 || ($iCount == 0 && !isLogged()))
+	    	return false;
+
+		return array($sSystem, $iObjectId, $iCount);
+    }
+    
     protected function _prepareParams($sType, $iOwnerId, $iStart, $iPerPage, $sFilter, $aModules, $iTimeline)
     {
     	$aParams = array();

+ 51 - 96
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -99,7 +99,7 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 
     public function getViewItemBlock($iId)
     {
-    	$aEvent = $this->_oDb->getEvents(array('type' => 'id', 'value' => $iId));
+    	$aEvent = $this->_oDb->getEvents(array('browse' => 'id', 'value' => $iId));
     	if(empty($aEvent))
     		return '';
 
@@ -327,7 +327,8 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         list($sAuthorName, $sAuthorUrl, $sAuthorIcon) = $oModule->getUserInfo($aEvent['object_owner_id']);
         $bAuthorIcon = !empty($sAuthorIcon);
 
-        $aTmplVarsMenu = $this->_getTmplVarsItemMenu($aEvent);
+        $aTmplVarsMenuItemManage = $this->_getTmplVarsMenuItemManage($aEvent, $aBrowseParams);
+        $aTmplVarsMenuItemActions = $this->_getTmplVarsMenuItemActions($aEvent, $aBrowseParams);
 
         $aTmplVarsTimelineOwner = array();
         if(isset($aBrowseParams['type']) && $aBrowseParams['type'] == BX_TIMELINE_TYPE_CONNECTIONS)
@@ -340,9 +341,9 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         	'style_prefix' => $sStylePrefix,
         	'js_object' => $sJsObject,
         	'id' => $aEvent['id'],
-        	'bx_if:show_menu' => array(
-        		'condition' => !empty($aTmplVarsMenu),
-        		'content' => $aTmplVarsMenu
+        	'bx_if:show_menu_item_manage' => array(
+        		'condition' => !empty($aTmplVarsMenuItemManage),
+        		'content' => $aTmplVarsMenuItemManage
         	),
         	'bx_if:show_icon' => array(
         		'condition' => $bAuthorIcon,
@@ -362,30 +363,13 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         	),
         	'item_view_url' => $sViewUrl,
         	'item_date' => bx_time_js($aEvent['date']),
-        	'bx_if:show_comments' => array(
-				'condition' => false,
-				'content' => array()
-			),
-			'bx_if:show_votes' => array(
-				'condition' => false,
-				'content' => array()
+			'bx_if:show_menu_item_actions' => array(
+				'condition' => !empty($aTmplVarsMenuItemActions),
+        		'content' => $aTmplVarsMenuItemActions
 			),
-			'comments' => ''
+			'comments' => $this->_getComments($aEvent, $aBrowseParams)
         );
 
-        //--- Add Comments
-        if(!empty($aEvent['comments']) && is_array($aEvent['comments'])) {
-        	$aTmplVarsComments = $this->_getTmplVarsComments($aEvent['comments'], $aBrowseParams);
-        	if(is_array($aTmplVarsComments))
-        		$aTmplVars = array_merge($aTmplVars, $aTmplVarsComments);
-        }
-
-        //--- Add Votes
-        $aEvent['votes'] = '';
-        $aTmplVarsVotes = $this->_getTmplVarsVotes($aEvent['votes']);
-		if(is_array($aTmplVarsVotes))
-        	$aTmplVars = array_merge($aTmplVars, $aTmplVarsVotes);
-
         $sMethod = '_getTmplVarsContent' . ucfirst($sType);
         if(method_exists($this, $sMethod)) {
         	$aTmplVarsContent = $this->$sMethod($aEvent['content']);
@@ -396,27 +380,51 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         return $this->parseHtmlByName($sType . '.html', $aTmplVars);
     }
 
-    protected function _getTmplVarsItemMenu(&$aEvent) {
+	protected function _getComments($aEvent, $aBrowseParams)
+    {
+    	$mixedComments = $this->getModule()->getCommentsData($aEvent);
+    	if($mixedComments === false || !isset($aBrowseParams['type']) || $aBrowseParams['type'] != 'view_item')
+    		return '';
+
+    	list($sSystem, $iObjectId, $iCount) = $mixedComments;
+		return $this->getComments($sSystem, $iObjectId);
+    }
+
+    protected function _getTmplVarsMenuItemManage(&$aEvent) {
     	$oModule = $this->getModule();
-    	$sStylePrefix = $this->_oConfig->getPrefix('style');
-		$sJsObject = $this->_oConfig->getJsObject('view');
 
-    	$aMenuItems = array();
-        if($oModule->isAllowedDelete())
-        	$aMenuItems[] = array('name' => 'timeline-item-delete', 'link' => 'javascript:void(0)', 'onclick' => "javascript:" . $sJsObject . ".deletePost(this, " . $aEvent['id'] . ")", 'target' => '_self', 'icon' => 'remove', 'title' => _t('_bx_timeline_menu_item_delete'));
+		bx_import('BxDolMenu');
+		$oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_manage'));
+		$oMenu->setEvent($aEvent);
 
-		$aTmplVarsMenu = array();
-		if(!empty($aMenuItems)) {
-			bx_import('BxTemplFunctions');
+		bx_import('BxTemplFunctions');
+		$sMenu = BxTemplFunctions::getInstance()->designBoxMenu($oMenu);
+		if(empty($sMenu))
+			return array();
 
-			$aTmplVarsMenu = array(
-        		'style_prefix' => $sStylePrefix,
-        		'js_object' => $sJsObject,
-				'menu' => BxTemplFunctions::getInstance()->designBoxMenu(array ('template' => 'menu_vertical.html', 'menu_items' => $aMenuItems))
-			);
-		}
+		return array(
+        	'style_prefix' => $this->_oConfig->getPrefix('style'),
+        	'js_object' => $this->_oConfig->getJsObject('view'),
+			'menu_item_manage' => $sMenu
+		);
+    }
 
-		return $aTmplVarsMenu;
+    protected function _getTmplVarsMenuItemActions(&$aEvent) {
+    	$oModule = $this->getModule();
+
+		bx_import('BxDolMenu');
+		$oMenu = BxDolMenu::getObjectInstance($this->_oConfig->getObject('menu_item_actions'));
+		$oMenu->setEvent($aEvent);
+
+		$sMenu = $oMenu->getCode();
+		if(empty($sMenu))
+			return array();
+
+		return array(
+        	'style_prefix' => $this->_oConfig->getPrefix('style'),
+        	'js_object' => $this->_oConfig->getJsObject('view'),
+			'menu_item_actions' => $sMenu
+		);
     }
 
     protected function _getTmplVarsTimelineOwner(&$aEvent)
@@ -436,60 +444,6 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         return $aTmplVarsTimelineOwner;
     }
 
-	protected function _getTmplVarsComments($aComments, $aBrowseParams)
-    {
-    	$sStylePrefix = $this->_oConfig->getPrefix('style');
-
-    	$sSystem = isset($aComments['system']) ? $aComments['system'] : '';
-    	$iObjectId = isset($aComments['object_id']) ? (int)$aComments['object_id'] : 0;
-    	$iCount = isset($aComments['count']) ? (int)$aComments['count'] : 0;
-    	if($sSystem == '' || $iObjectId == 0 || ($iCount == 0 && !isLogged()))
-    		return array();
-
-    	$oCmts = $this->getModule()->getCmtsObject($sSystem, $iObjectId);
-    	$oCmts->addCssJs();
-
-    	$sComments = '';
-    	if(isset($aBrowseParams['type']) && $aBrowseParams['type'] == 'view_item')
-			$sComments = $this->getComments($sSystem, $iObjectId);
-
-		return array(
-    		'bx_if:show_comments' => array(
-    			'condition' => true,
-    			'content' => array(
-					'style_prefix' => $sStylePrefix,
-					'url' => 'javascript:void(0)',
-					'onclick' => "javascript:" . $this->_oConfig->getJsObject('view') . ".commentItem(this, '" . $sSystem . "', " . $iObjectId . ")",
-					'content' => $iCount > 0 ? _t('_bx_timeline_txt_n_comments', $iCount) : _t('_bx_timeline_txt_comment')
-				)
-			),
-			'comments' => $sComments
-		);
-    }
-
-	protected function _getTmplVarsVotes($aVotes)
-    {
-    	$sStylePrefix = $this->_oConfig->getPrefix('style');
-/*
-    	$sSystem = isset($aComments['system']) ? $aComments['system'] : '';
-    	$iObjectId = isset($aComments['object_id']) ? (int)$aComments['object_id'] : 0;
-    	$iCount = isset($aComments['count']) ? (int)$aComments['count'] : 0;
-    	if($sSystem == '' || $iObjectId == 0 || ($iCount == 0 && !isLogged()))
-    		return array();
-*/
-		return array(
-    		'bx_if:show_votes' => array(
-    			'condition' => true,
-    			'content' => array(
-					'style_prefix' => $sStylePrefix,
-					'url' => 'javascript:void(0)',
-					'onclick' => "javascript:" . $this->_oConfig->getJsObject('view') . ".voteItem(this)",
-					'content' => _t('_bx_timeline_txt_plus')
-				)
-			)
-		);
-    }
-
 	protected function _getTmplVarsContentText($aContent)
     {
     	$sStylePrefix = $this->_oConfig->getPrefix('style');
@@ -638,6 +592,7 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 
         return $mixedResult;
     }
+
 	protected function _prepareTextForOutput($s)
     {
 		$s = bx_process_output($s, BX_DATA_TEXT);

+ 22 - 11
modules/boonex/timeline/install/langs/en.xml

@@ -66,25 +66,39 @@
 	<string name="_bx_timeline_page_block_title_view_account"><![CDATA[Timeline]]></string>
 
 	<!--
+	<string name="_bx_timeline_menu_title_XXX"><![CDATA[View Person Submenu]]></string>
     <string name="_bx_timeline_menu_set_title_XXX"><![CDATA[Notes Submenu]]></string>
     <string name="_bx_timeline_menu_item_title_system_XXX"><![CDATA[]]></string>
     <string name="_bx_timeline_menu_item_title_XXX"><![CDATA[]]></string>
 
 	<string name="_bx_timeline_txt_error_XXX"><![CDATA[]]></string>
-    -->
+    -->    
 
     <string name="_bx_timeline_menu_item_view_all"><![CDATA[All posts]]></string>
     <string name="_bx_timeline_menu_item_view_owner"><![CDATA[Posts by {0}]]></string>
     <string name="_bx_timeline_menu_item_view_other"><![CDATA[Posts by others]]></string>
     <string name="_bx_timeline_menu_item_get_rss"><![CDATA[RSS]]></string>
 
-    <string name="_bx_timeline_menu_item_write"><![CDATA[Write]]></string>
-    <string name="_bx_timeline_menu_item_share_link"><![CDATA[Share a link]]></string>
-    <string name="_bx_timeline_menu_item_add_photo"><![CDATA[Add a photo]]></string>
-    <string name="_bx_timeline_menu_item_add_music"><![CDATA[Add a sound]]></string>
-    <string name="_bx_timeline_menu_item_add_video"><![CDATA[Add a video]]></string>
-
-    <string name="_bx_timeline_menu_item_delete"><![CDATA[Delete]]></string>
+	<string name="_bx_timeline_menu_title_post"><![CDATA[Post Item]]></string>
+    <string name="_bx_timeline_menu_set_title_post"><![CDATA[Post Item]]></string>
+    <string name="_bx_timeline_menu_item_title_system_post_text"><![CDATA[Post Text]]></string>
+    <string name="_bx_timeline_menu_item_title_post_text"><![CDATA[Write]]></string>
+    <string name="_bx_timeline_menu_item_title_system_post_link"><![CDATA[Post Link]]></string>
+    <string name="_bx_timeline_menu_item_title_post_link"><![CDATA[Share a link]]></string>
+    <string name="_bx_timeline_menu_item_title_system_post_photo"><![CDATA[Post Photo]]></string>
+    <string name="_bx_timeline_menu_item_title_post_photo"><![CDATA[Add a photo]]></string>
+
+    <string name="_bx_timeline_menu_title_item_manage"><![CDATA[Manage Item]]></string>
+    <string name="_bx_timeline_menu_set_title_item_manage"><![CDATA[Manage Item]]></string>
+    <string name="_bx_timeline_menu_item_title_system_item_delete"><![CDATA[Delete]]></string>
+    <string name="_bx_timeline_menu_item_title_item_delete"><![CDATA[Delete]]></string>
+
+	<string name="_bx_timeline_menu_title_item_actions"><![CDATA[Item Actions]]></string>
+    <string name="_bx_timeline_menu_set_title_item_actions"><![CDATA[Item Actions]]></string>
+    <string name="_bx_timeline_menu_item_title_system_item_comment"><![CDATA[Comment]]></string>
+    <string name="_bx_timeline_menu_item_title_item_comment"><![CDATA[Comment]]></string>
+    <string name="_bx_timeline_menu_item_title_system_item_vote"><![CDATA[Vote]]></string>
+    <string name="_bx_timeline_menu_item_title_item_vote"><![CDATA[Vote]]></string>
 
     <string name="_bx_timeline_menu_item_title_system_timeline"><![CDATA[Timeline]]></string>
     <string name="_bx_timeline_menu_item_title_timeline"><![CDATA[Timeline]]></string>
@@ -102,9 +116,6 @@
 	<string name="_bx_timeline_txt_added_photo"><![CDATA[added a photo]]></string>
 	<string name="_bx_timeline_txt_date_from"><![CDATA[today]]></string>
 	<string name="_bx_timeline_txt_date_to"><![CDATA[olden days]]></string>
-	
-	<string name="_bx_timeline_txt_comment"><![CDATA[Comment]]></string>
-	<string name="_bx_timeline_txt_n_comments"><![CDATA[{0} comments]]></string>
 
 	<string name="_bx_timeline_txt_plus"><![CDATA[Plus]]></string>
 	

+ 2 - 0
modules/boonex/timeline/install/sql/disable.sql

@@ -4,6 +4,8 @@ DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_timeline';
 
 
 -- 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';
 
 

+ 36 - 11
modules/boonex/timeline/install/sql/enable.sql

@@ -20,7 +20,42 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 ('bx_persons_view_profile', @iPBCellProfile, 'bx_timeline', '_bx_timeline_page_block_title_view_profile', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:22:"get_block_view_profile";}', 0, 1, @iPBOrderProfile + 2);
 
 
--- MENU
+-- MENUS
+
+-- MENU: Post Item (Text, Link, Photo)
+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', '_bx_timeline_menu_title_post', 'bx_timeline_menu_post', 'bx_timeline', 11, 0, 1, 'BxTimelineMenuPost', 'modules/boonex/timeline/classes/BxTimelineMenuPost.php');
+
+INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
+('bx_timeline_menu_post', 'bx_timeline', '_bx_timeline_menu_set_title_post', 0);
+
+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 
+('bx_timeline_menu_post', 'bx_timeline', 'post-text', '_bx_timeline_menu_item_title_system_post_text', '_bx_timeline_menu_item_title_post_text', 'javascript:void(0)', 'javascript:{js_object_post}.changePostType(this, ''text'')', '_self', '', '', 2147483647, 1, 0, 0),
+('bx_timeline_menu_post', 'bx_timeline', 'post-link', '_bx_timeline_menu_item_title_system_post_link', '_bx_timeline_menu_item_title_post_link', 'javascript:void(0)', 'javascript:{js_object_post}.changePostType(this, ''link'')', '_self', '', '', 2147483647, 1, 0, 0),
+('bx_timeline_menu_post', 'bx_timeline', 'post-photo', '_bx_timeline_menu_item_title_system_post_photo', '_bx_timeline_menu_item_title_post_photo', 'javascript:void(0)', 'javascript:{js_object_post}.changePostType(this, ''photo'')', '_self', '', '', 2147483647, 1, 0, 0);
+
+-- MENU: Item Manage (Delete)
+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_manage', '_bx_timeline_menu_title_item_manage', 'bx_timeline_menu_item_manage', 'bx_timeline', 6, 0, 1, 'BxTimelineMenuItem', 'modules/boonex/timeline/classes/BxTimelineMenuItem.php');
+
+INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
+('bx_timeline_menu_item_manage', 'bx_timeline', '_bx_timeline_menu_set_title_item_manage', 0);
+
+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 
+('bx_timeline_menu_item_manage', 'bx_timeline', 'item-delete', '_bx_timeline_menu_item_title_system_item_delete', '_bx_timeline_menu_item_title_item_delete', 'javascript:void(0)', 'javascript:{js_object_view}.deletePost(this, {content_id})', '_self', 'remove', '', 2147483647, 1, 0, 0);
+
+-- MENU: Item Actions (Comment, Plus)
+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_actions', '_bx_timeline_menu_title_item_actions', 'bx_timeline_menu_item_actions', 'bx_timeline', 10, 0, 1, 'BxTimelineMenuItem', 'modules/boonex/timeline/classes/BxTimelineMenuItem.php');
+
+INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
+('bx_timeline_menu_item_actions', 'bx_timeline', '_bx_timeline_menu_set_title_item_actions', 0);
+
+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 
+('bx_timeline_menu_item_actions', 'bx_timeline', 'item-comment', '_bx_timeline_menu_item_title_system_item_comment', '_bx_timeline_menu_item_title_item_comment', 'javascript:void(0)', 'javascript:{js_object_view}.commentItem(this, ''{comments_system}'', {content_id})', '_self', 'comment', '', 2147483647, 1, 0, 0),
+('bx_timeline_menu_item_actions', 'bx_timeline', 'item-vote', '_bx_timeline_menu_item_title_system_item_vote', '_bx_timeline_menu_item_title_item_vote', 'javascript:void(0)', 'javascript:{js_object_view}.voteItem(this, {content_id})', '_self', 'plus', '', 2147483647, 1, 0, 0);
+
+-- MENU: Account Settings
 SET @iMIOrder = (SELECT MAX(`order`) FROM `sys_menu_items` WHERE `set_name`='sys_account_settings' LIMIT 1);
 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_account_settings', 'bx_timeline', 'account-settings-timeline', '_bx_timeline_menu_item_title_system_timeline', '_bx_timeline_menu_item_title_timeline', 'page.php?i=timeline-account', '', '', 'clock-o', '', 2147483646, 1, 1, @iMIOrder + 1);
@@ -70,10 +105,6 @@ INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`,
 ('bx_timeline', 'delete', NULL, '_bx_timeline_acl_action_delete', '', 1, 1);
 SET @iIdActionDelete = LAST_INSERT_ID();
 
-INSERT INTO `sys_acl_actions` (`Module`, `Name`, `AdditionalParamName`, `Title`, `Desc`, `Countable`, `DisabledForLevels`) VALUES
-('bx_timeline', 'comment', NULL, '_bx_timeline_acl_action_comment', '', 1, 1);
-SET @iIdActionComment = LAST_INSERT_ID();
-
 SET @iUnauthenticated = 1;
 SET @iStandard = 2;
 SET @iUnconfirmed = 3;
@@ -95,12 +126,6 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 (@iModerator, @iIdActionDelete),
 (@iAdministrator, @iIdActionDelete),
 
--- comment
-(@iStandard, @iIdActionComment),
-(@iModerator, @iIdActionComment),
-(@iAdministrator, @iIdActionComment),
-(@iPremium, @iIdActionComment);
-
 
 -- ALERTS
 INSERT INTO `sys_alerts_handlers`(`name`, `class`, `file`, `eval`) VALUES 

+ 2 - 1
modules/boonex/timeline/js/view.js

@@ -103,7 +103,8 @@ BxTimelineView.prototype.showMoreContent = function(oLink) {
 
 BxTimelineView.prototype.showItemMenu = function(oLink) {
 	var sId = $(oLink).parents('.bx-tl-item-menu:first').children('.bx-db-menu-popup:hidden').attr('id');
-	bx_menu_popup_inline('#' + sId, oLink);
+	if(sId)
+		bx_menu_popup_inline('#' + sId, oLink);
 };
 
 BxTimelineView.prototype.showItem = function(oLink, iId) {

+ 8 - 12
modules/boonex/timeline/template/text.html

@@ -25,16 +25,16 @@
 				<div class="__style_prefix__-date bx-def-font-small bx-def-font-grayed">
 					<a href="__item_view_url__" onclick="javascript:return __js_object__.showItem(this, __id__)">__item_date__</a>
 				</div>
-				<bx_if:show_menu>
+				<bx_if:show_menu_item_manage>
 					<div class="__style_prefix__-item-menu">
-						__menu__
+						__menu_item_manage__
 						<div class="__style_prefix__-item-menu-button">
 				   			<a href="javascript:void(0)" onclick="javascript:__js_object__.showItemMenu(this);">
 								<i class="sys-icon chevron-down"></i>
 							</a>
 						</div>
 					</div>
-			   	</bx_if:show_menu>
+			   	</bx_if:show_menu_item_manage>
 			</div>
 			<bx_if:show_title>
 				<div class="__style_prefix__-title bx-def-margin-sec-bottom bx-def-font-large">__title__</div>
@@ -44,15 +44,11 @@
 				__item_content__<bx_if:show_more><span class="__style_prefix__-content-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMoreContent(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __item_content_more__</span></bx_if:show_more>
 				</div>
 			</bx_if:show_content>
-
-			<div class="__style_prefix__-actions">
-				<bx_if:show_comments>
-					<a class="bx-def-margin-left-auto" href="__url__" onclick="__onclick__"><i class="sys-icon comment"></i>&nbsp;__content__</a>
-				</bx_if:show_comments>
-				<bx_if:show_votes>
-					<a class="bx-def-margin-left-auto" href="__url__" onclick="__onclick__"><i class="sys-icon plus"></i>&nbsp;__content__</a>
-				</bx_if:show_votes>
-			</div>
+			<bx_if:show_menu_item_actions>
+				<div class="__style_prefix__-actions">
+					__menu_item_actions__
+				</div>
+			</bx_if:show_menu_item_actions>
 			__comments__
 		</div>
 	</div>

+ 11 - 0
template/menu_inline.html

@@ -0,0 +1,11 @@
+<ul id="bx-menu-inline" class="bx-menu-hor bx-menu-object-__object__ bx-clearfix">
+    <bx_repeat:menu_items>
+        <li class="__class_add__">
+        	<a href="__link__" target="__target__" onclick="__onclick__">
+				<bx_if:icon><i class="sys-icon __icon__"></i></bx_if:icon>
+				<bx_if:image><img style="background-image:url(__icon_url__)" src="<bx_icon_url:spacer.gif />" /></bx_if:image>
+				<span>__title__</span>
+			</a>
+		</li>
+    </bx_repeat:menu_items>
+</ul>

+ 3 - 3
template/menu_interactive_vertical.html

@@ -1,10 +1,10 @@
 <ul id="bx-menu-inter-__id__" class="bx-menu-inter-vert bx-menu-object-__object__">
 	<bx_repeat:menu_items>
-	    <li id="__id__-act" class="bx-menu-inter-act __class_wrp_act__">
+	    <li id="__name__-act" class="bx-menu-inter-act __class_wrp_act__">
 	        <div class="bx-def-padding-right bx-def-padding-sec-left bx-def-padding-sec-topbottom __class__">__title__</div>
 	    </li>
-	    <li id="__id__-pas" class="bx-menu-inter-pas bx-def-round-corners bx-def-color-bg-hl-hover __class_wrp_pas__">
-	        <a id="__id__" class="__class__" href="__link__" target="__target__" onclick="__onclick__">
+	    <li id="__name__-pas" class="bx-menu-inter-pas bx-def-round-corners bx-def-color-bg-hl-hover __class_wrp_pas__">
+	        <a id="__name__" class="__class__" href="__link__" target="__target__" onclick="__onclick__">
 	        	<div class="bx-def-padding-right bx-def-padding-sec-left bx-def-padding-sec-topbottom">__title__</div>
 	        </a>
 	    </li>

+ 0 - 1
template/scripts/BxBaseMenuInteractive.php

@@ -50,7 +50,6 @@ class BxBaseMenuInteractive extends BxTemplMenu {
             $this->_aObject['menu_items'] = $this->_oQuery->getMenuItems();
 
         foreach ($this->_aObject['menu_items'] as $a) {
-
             if (isset($a['active']) && !$a['active'])
                 continue;