Przeglądaj źródła

#92 - Integrate comments in search engine, Timeline.

AntonLV 12 lat temu
rodzic
commit
a22a58c58f

+ 3 - 14
modules/base/notifications/classes/BxBaseModNotificationsConfig.php

@@ -9,13 +9,12 @@
  * @{
  */
 
-bx_import('BxDolModuleConfig');
+bx_import('BxBaseModGeneralConfig');
 
-class BxBaseModNotificationsConfig extends BxDolModuleConfig
+class BxBaseModNotificationsConfig extends BxBaseModGeneralConfig
 {
 	protected $_oDb;
 
-	protected $_aSystemNames;
     protected $_aPrefixes;
     protected $_aObjects;
 
@@ -39,11 +38,9 @@ class BxBaseModNotificationsConfig extends BxDolModuleConfig
     {
         parent::__construct($aModule);
 
-        $this->_aSystemNames = array(
-			'alert' => $this->_sName
-		);
 		$this->_aPrefixes = array();
 		$this->_aObjects = array(
+			'alert' => $this->_sName,
 			'conn_subscriptions' => 'sys_profiles_subscriptions'
 		);
 
@@ -85,14 +82,6 @@ class BxBaseModNotificationsConfig extends BxDolModuleConfig
             $this->_aHandlersHidden = explode(',', $sHideTimeline);
     }
 
-	public function getSystemName($sType = '')
-    {
-    	if(empty($sType))
-            return $this->_aSystemNames;
-
-        return $this->_aSystemNames[$sType];
-    }
-
     public function getPrefix($sType = '')
     {
     	if(empty($sType))

+ 1 - 1
modules/base/notifications/classes/BxBaseModNotificationsDb.php

@@ -33,7 +33,7 @@ class BxBaseModNotificationsDb extends BxDolModuleDb
 
     public function getAlertHandlerId()
     {
-        $sQuery = $this->prepare("SELECT `id` FROM `sys_alerts_handlers` WHERE `name`=? LIMIT 1", $this->_oConfig->getSystemName('alert'));
+        $sQuery = $this->prepare("SELECT `id` FROM `sys_alerts_handlers` WHERE `name`=? LIMIT 1", $this->_oConfig->getObject('alert'));
         return (int)$this->getOne($sQuery);
     }
 

+ 1 - 1
modules/boonex/notifications/classes/BxNtfsModule.php

@@ -82,7 +82,7 @@ class BxNtfsModule extends BxBaseModNotificationsModule
     {
     	//--- Event -> Post for Alerts Engine ---//
         bx_import('BxDolAlerts');
-        $oAlert = new BxDolAlerts($this->_oConfig->getSystemName('alert'), 'post', $iId);
+        $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'post', $iId);
         $oAlert->alert();
         //--- Event -> Post for Alerts Engine ---//
     }

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

@@ -23,7 +23,7 @@ DELETE `sys_acl_actions`, `sys_acl_matrix` FROM `sys_acl_actions`, `sys_acl_matr
 DELETE FROM `sys_acl_actions` WHERE `Module` = 'bx_posts';
 
 -- SEARCH
-DELETE FROM `sys_objects_search` WHERE `ObjectName` = 'bx_posts';
+DELETE FROM `sys_objects_search` WHERE `ObjectName` IN ('bx_posts', 'bx_posts_cmts');
 
 -- METATAGS
 DELETE FROM `sys_objects_metatags` WHERE `object` = 'bx_posts';

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

@@ -40,11 +40,16 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
     {
         parent::__construct($aModule);
 
-        $this->_aSystemNames = array(
-			'alert' => $this->_sName,
-        	'comment' => $this->_sName,
-        	'vote' => $this->_sName
-		);
+        $this->CNF = array (
+        	// objects
+            'OBJECT_COMMENTS' => $this->_sName,
+        
+        	// some language keys
+            'T' => array (
+                'txt_sample_single' => '_bx_timeline_txt_sample',
+            	'txt_sample_comment_single' => '_bx_timeline_txt_sample_comment_single',
+            ),
+        );
 
         $this->_aPrefixes = array(
         	'style' => 'bx-tl',
@@ -54,6 +59,9 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         );
 
         $this->_aObjects = array(
+        	'alert' => $this->_sName,
+        	'comment' => $this->CNF['OBJECT_COMMENTS'],
+        	'vote' => $this->_sName,
         	'storage' => $this->_sName . '_photos',
         	'transcoder_preview' => $this->_sName . '_photos_preview',
         	'transcoder_view' => $this->_sName . '_photos_view',

+ 3 - 3
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -692,7 +692,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
         //--- Event -> Post for Alerts Engine ---//
         bx_import('BxDolAlerts');
-        $oAlert = new BxDolAlerts($this->_oConfig->getSystemName('alert'), 'post_' . $sPostType, $iId, $iSenderId);
+        $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'post_' . $sPostType, $iId, $iSenderId);
         $oAlert->alert();
         //--- Event -> Post for Alerts Engine ---//
     }
@@ -715,7 +715,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
         //--- Timeline -> Update for Alerts Engine ---//
         bx_import('BxDolAlerts');
-        $oAlert = new BxDolAlerts($this->_oConfig->getSystemName('alert'), 'share', $aShared['id'], $iUserId);
+        $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'share', $aShared['id'], $iUserId);
         $oAlert->alert();
         //--- Timeline -> Update for Alerts Engine ---//
     }
@@ -761,7 +761,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule
 
         //--- Event -> Delete for Alerts Engine ---//
         bx_import('BxDolAlerts');
-        $oAlert = new BxDolAlerts($this->_oConfig->getSystemName('alert'), 'delete', $aEvent['id'], $this->getUserId());
+        $oAlert = new BxDolAlerts($this->_oConfig->getObject('alert'), 'delete', $aEvent['id'], $this->getUserId());
         $oAlert->alert();
         //--- Event -> Delete for Alerts Engine ---//
     }

+ 2 - 2
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -859,7 +859,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                 break;
         }
 
-        $sSystem = $this->_oConfig->getSystemName('vote');
+        $sSystem = $this->_oConfig->getObject('vote');
         if($oModule->getVoteObject($sSystem, $aEvent['id']) !== false)
             $aResult['votes'] = array(
                 'system' => $sSystem,
@@ -867,7 +867,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
                 'count' => $aEvent['votes']
             );
 
-        $sSystem = $this->_oConfig->getSystemName('comment');
+        $sSystem = $this->_oConfig->getObject('comment');
         if($oModule->getCmtsObject($sSystem, $aEvent['id']) !== false)
             $aResult['comments'] = array(
                 'system' => $sSystem,

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

@@ -2,6 +2,7 @@
 <resources name="en" flag="gb" title="English">
 
 	<string name="_bx_timeline"><![CDATA[Timeline]]></string>
+	<string name="_bx_timeline_cmts"><![CDATA[Timelines' Comments]]></string>
 
 	<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>
@@ -55,6 +56,7 @@
 	<string name="_bx_timeline_page_block_title_item"><![CDATA[Item]]></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_page_block_title_browse_cmts"><![CDATA[Timelines' Comments]]></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>
@@ -94,6 +96,7 @@
 	<string name="_bx_timeline_txt_user_added_sample"><![CDATA[{0} added {1}]]></string>
 	<string name="_bx_timeline_txt_user_shared_sample"><![CDATA[{0} shared {1}'s {2}]]></string>
 	<string name="_bx_timeline_txt_sample"><![CDATA[post]]></string>
+	<string name="_bx_timeline_txt_sample_comment_single"><![CDATA[post's comment]]></string>
 
 	<string name="_bx_timeline_txt_do_share"><![CDATA[Share]]></string>
 	<string name="_bx_timeline_txt_shared"><![CDATA[Shared {0}'s {1}.]]></string>

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

@@ -36,5 +36,9 @@ DELETE FROM `sys_objects_cmts` WHERE `Name`='bx_timeline' LIMIT 1;
 DELETE FROM `sys_objects_vote` WHERE `Name`='bx_timeline' LIMIT 1;
 
 
+-- SEARCH
+DELETE FROM `sys_objects_search` WHERE `ObjectName` IN ('bx_timeline_cmts');
+
+
 -- MODULES' CONNECTIONS
 DELETE FROM `sys_modules_relations` WHERE `module`='bx_timeline' LIMIT 1;

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

@@ -141,6 +141,11 @@ INSERT INTO `sys_objects_vote`(`Name`, `TableMain`, `TableTrack`, `PostTimeout`,
 ('bx_timeline', 'bx_timeline_votes', 'bx_timeline_votes_track', '604800', '1', '1', '1', '1', 'bx_timeline_events', 'id', 'rate', 'votes', 'BxTimelineVote', 'modules/boonex/timeline/classes/BxTimelineVote.php');
 
 
+-- SEARCH
+INSERT INTO `sys_objects_search` (`ObjectName`, `Title`, `ClassName`, `ClassPath`) VALUES
+('bx_timeline_cmts', '_bx_timeline_cmts', 'BxTimelineCmtsSearchResult', 'modules/boonex/timeline/classes/BxTimelineCmtsSearchResult.php');
+
+
 -- MODULES' CONNECTIONS
 INSERT INTO `sys_modules_relations` (`module`, `on_install`, `on_uninstall`, `on_enable`, `on_disable`) VALUES
 ('bx_timeline', '', 'delete_module_events', 'add_handlers', 'delete_handlers');