Преглед изворни кода

Merge branch 'master' of github.com:boonex/dolphin

Alex Trofimov пре 12 година
родитељ
комит
04ba506248

+ 1 - 0
modules/base/notifications/classes/BxBaseModNotificationsModule.php

@@ -17,6 +17,7 @@ define('BX_BASE_MOD_NTFS_HANDLER_TYPE_DELETE', 'delete');
 
 define('BX_BASE_MOD_NTFS_TYPE_OWNER', 'owner');
 define('BX_BASE_MOD_NTFS_TYPE_CONNECTIONS', 'connections');
+define('BX_BASE_MOD_NTFS_TYPE_PUBLIC', 'public');
 
 /**
  * Base module class.

+ 2 - 3
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -16,8 +16,6 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
 {
     protected $_bAllowDelete;
 
-    protected $_iPerPageProfile;
-    protected $_iPerPageAccount;
     protected $_iRssLength;
     protected $_iCharsDisplayMax;
 
@@ -128,7 +126,8 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         $this->_aPerPage = array(
     		'default' => 10,
         	'profile' => (int)getParam($sOptionPrefix . 'events_per_page_profile'),
-        	'account' => (int)getParam($sOptionPrefix . 'events_per_page_account')
+        	'account' => (int)getParam($sOptionPrefix . 'events_per_page_account'),
+        	'home' => (int)getParam($sOptionPrefix . 'events_per_page_home')
     	);
 
         $this->_iRssLength = (int)getParam($sOptionPrefix . 'rss_length');

+ 26 - 16
modules/boonex/timeline/classes/BxTimelineDb.php

@@ -263,25 +263,35 @@ class BxTimelineDb extends BxBaseModNotificationsDb
 			$sWhereClause .= $sWhereModuleFilter;
 
 		//--- Check type
-		if(!empty($aParams['owner_id']))
-			switch($aParams['type']) {
-				case BX_BASE_MOD_NTFS_TYPE_OWNER:
-					$sWhereClause .= $this->prepare("AND `{$this->_sTable}`.`owner_id`=? ", $aParams['owner_id']);
+		switch($aParams['type']) {
+			case BX_BASE_MOD_NTFS_TYPE_OWNER:
+				if(empty($aParams['owner_id']))
 					break;
 
-				case BX_BASE_MOD_NTFS_TYPE_CONNECTIONS:
-					bx_import('BxDolConnection');
-					$oConnection = BxDolConnection::getObjectInstance($this->_oConfig->getObject('conn_subscriptions'));
-					
-					$aQueryParts = $oConnection->getConnectedContentAsSQLParts($this->_sPrefix . "events", 'owner_id', $aParams['owner_id']);
-					$sJoinClause .= ' ' . $aQueryParts['join'];
-					
-					$iUserId = bx_get_logged_profile_id();
-					$sCommonPostPrefix = $this->_oConfig->getPrefix('common_post');
-					
-					$sWhereClause .= "AND IF(SUBSTRING(`{$this->_sTable}`.`type`, 1, " . strlen($sCommonPostPrefix) . ") = '" . $sCommonPostPrefix . "', `{$this->_sTable}`.`object_id` <> " . $iUserId . ", 1)";
+				$sWhereClause .= $this->prepare("AND `{$this->_sTable}`.`owner_id`=? ", $aParams['owner_id']);
+				break;
+
+			case BX_BASE_MOD_NTFS_TYPE_CONNECTIONS:
+				if(empty($aParams['owner_id']))
 					break;
-			}
+
+				bx_import('BxDolConnection');
+				$oConnection = BxDolConnection::getObjectInstance($this->_oConfig->getObject('conn_subscriptions'));
+
+				$aQueryParts = $oConnection->getConnectedContentAsSQLParts($this->_sPrefix . "events", 'owner_id', $aParams['owner_id']);
+				$sJoinClause .= ' ' . $aQueryParts['join'];
+
+				$iUserId = bx_get_logged_profile_id();
+				$sCommonPostPrefix = $this->_oConfig->getPrefix('common_post');
+
+				$sWhereClause .= "AND IF(SUBSTRING(`{$this->_sTable}`.`type`, 1, " . strlen($sCommonPostPrefix) . ") = '" . $sCommonPostPrefix . "', `{$this->_sTable}`.`object_id` <> " . $iUserId . ", 1) ";
+				break;
+
+			case BX_BASE_MOD_NTFS_TYPE_PUBLIC:
+				$sCommonPostPrefix = $this->_oConfig->getPrefix('common_post');
+				$sWhereClause .= "AND SUBSTRING(`{$this->_sTable}`.`type`, 1, " . strlen($sCommonPostPrefix) . ") <> '" . $sCommonPostPrefix . "' ";
+				break;
+		}
 
 		return array($sJoinClause, $sWhereClause);
     }

+ 11 - 0
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -343,6 +343,17 @@ class BxTimelineModule extends BxBaseModNotificationsModule
         return array('content' => $sContent);
     }
 
+	public function serviceGetBlockViewHome($iProfileId = 0, $iStart = -1, $iPerPage = -1, $iTimeline = -1, $sFilter = '', $aModules = array())
+    {
+        $aParams = $this->_prepareParams(BX_BASE_MOD_NTFS_TYPE_PUBLIC, $iProfileId, $iStart, $iPerPage, $sFilter, $aModules, $iTimeline);
+        $aParams['per_page'] = (int)$iPerPage > 0 ? $iPerPage : $this->_oConfig->getPerPage('home');
+
+        $this->_iOwnerId = $aParams['owner_id'];
+
+        $sContent = $this->_oTemplate->getViewBlock($aParams);
+        return array('content' => $sContent);
+    }
+
     public function serviceGetBlockItem()
     {
         $iItemId = bx_process_input(bx_get('id'), BX_DATA_INT);

+ 3 - 1
modules/boonex/timeline/install/langs/en.xml

@@ -6,6 +6,7 @@
 	<string name="_bx_timeline_option_enable_delete"><![CDATA[Allow Timeline owner to remove items]]></string>
 	<string name="_bx_timeline_option_events_per_page_profile"><![CDATA[Number of events are displayed on Profile page]]></string>
 	<string name="_bx_timeline_option_events_per_page_account"><![CDATA[Number of events are displayed on Account page]]></string>
+	<string name="_bx_timeline_option_events_per_page_home"><![CDATA[Number of events are displayed on Home page]]></string>
 	<string name="_bx_timeline_option_rss_length"><![CDATA[The length of RSS feed]]></string>
 	<string name="_bx_timeline_option_events_hide"><![CDATA[Show events in Timeline]]></string>
 	<string name="_bx_timeline_option_chars_display_max"><![CDATA[Max number of displayed character in text post]]></string>
@@ -52,7 +53,8 @@
 	<string name="_bx_timeline_page_block_title_post_profile"><![CDATA[Post to Timeline]]></string>
 	<string name="_bx_timeline_page_block_title_view_profile"><![CDATA[Timeline]]></string>
 	<string name="_bx_timeline_page_block_title_item"><![CDATA[Item]]></string>
-	<string name="_bx_timeline_page_block_title_view_account"><![CDATA[Timeline]]></string>
+	<string name="_bx_timeline_page_block_title_view_account"><![CDATA[Subscriptions Timeline]]></string>
+	<string name="_bx_timeline_page_block_title_view_home"><![CDATA[Outline]]></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>

+ 14 - 9
modules/boonex/timeline/install/sql/enable.sql

@@ -11,17 +11,21 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 ('bx_timeline_item', 1, 'bx_timeline', '_bx_timeline_page_block_title_item', 0, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:14:"get_block_item";}', 0, 0, 1);
 
 SET @iPBCellProfile = 4;
-SET @iPBOrderProfile = (SELECT MAX(`order`) FROM `sys_pages_blocks` WHERE `object`='bx_persons_view_profile' AND `cell_id` = @iPBCellProfile LIMIT 1);
+SET @iPBOrderProfile = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_pages_blocks` WHERE `object`='bx_persons_view_profile' AND `cell_id` = @iPBCellProfile LIMIT 1);
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
-('bx_persons_view_profile', @iPBCellProfile, 'bx_timeline', '_bx_timeline_page_block_title_post_profile', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:22:"get_block_post_profile";}', 0, 0, IFNULL(@iPBOrderProfile, 0) + 1),
-('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, 0, IFNULL(@iPBOrderProfile, 0) + 2);
+('bx_persons_view_profile', @iPBCellProfile, 'bx_timeline', '_bx_timeline_page_block_title_post_profile', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:22:"get_block_post_profile";}', 0, 0, @iPBOrderProfile + 1),
+('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, 0, @iPBOrderProfile + 2);
 
 SET @iPBCellDashboard = 1;
-SET @iPBOrderDashboard = (SELECT MAX(`order`) FROM `sys_pages_blocks` WHERE `object` = 'bx_persons_view_profile' AND `cell_id` = @iPBCellProfile LIMIT 1);
+SET @iPBOrderDashboard = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_pages_blocks` WHERE `object` = 'bx_persons_view_profile' AND `cell_id` = @iPBCellProfile LIMIT 1);
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
-('sys_dashboard', @iPBCellDashboard, 'bx_timeline', '_bx_timeline_page_block_title_view_account', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:22:"get_block_view_account";}', 0, 1, IFNULL(@iPBOrderDashboard, 0) + 1);
+('sys_dashboard', @iPBCellDashboard, 'bx_timeline', '_bx_timeline_page_block_title_view_account', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:22:"get_block_view_account";}', 0, 1, @iPBOrderDashboard + 1);
+
+SET @iPBCellHome = 1;
+SET @iPBOrderHome = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_pages_blocks` WHERE `object` = 'sys_home' AND `cell_id` = @iPBCellHome ORDER BY `order` DESC LIMIT 1);
+INSERT INTO `sys_pages_blocks`(`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES 
+('sys_home', @iPBCellHome, 'bx_timeline', '_bx_timeline_page_block_title_view_home', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:19:"get_block_view_home";}', 0, 1, @iPBOrderHome + 1);
 
--- MENUS
 
 -- 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 
@@ -60,9 +64,10 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 ('bx_timeline_enable_delete', 'on', @iCategId, '_bx_timeline_option_enable_delete', 'checkbox', '', '', '', '', 1),
 ('bx_timeline_events_per_page_profile', '10', @iCategId, '_bx_timeline_option_events_per_page_profile', 'digit', '', '', '', '', 2),
 ('bx_timeline_events_per_page_account', '20', @iCategId, '_bx_timeline_option_events_per_page_account', 'digit', '', '', '', '', 3),
-('bx_timeline_rss_length', '5', @iCategId, '_bx_timeline_option_rss_length', 'digit', '', '', '', '', 4),
-('bx_timeline_events_hide', '', @iCategId, '_bx_timeline_option_events_hide', 'rlist', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:21:"get_actions_checklist";}', 5),
-('bx_timeline_chars_display_max', '300', @iCategId, '_bx_timeline_option_chars_display_max', 'digit', 'GreaterThan', 'a:1:{s:3:"min";i:150;}', '_bx_timeline_option_err_chars_display_max', '', 6);
+('bx_timeline_events_per_page_home', '20', @iCategId, '_bx_timeline_option_events_per_page_home', 'digit', '', '', '', '', 4),
+('bx_timeline_rss_length', '5', @iCategId, '_bx_timeline_option_rss_length', 'digit', '', '', '', '', 5),
+('bx_timeline_events_hide', '', @iCategId, '_bx_timeline_option_events_hide', 'rlist', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:21:"get_actions_checklist";}', 6),
+('bx_timeline_chars_display_max', '300', @iCategId, '_bx_timeline_option_chars_display_max', 'digit', 'GreaterThan', 'a:1:{s:3:"min";i:150;}', '_bx_timeline_option_err_chars_display_max', '', 7);
 
 
 -- ACL