Explorar el Código

#24 - 'Show events' setting and Reverse checkbox list. Additional fixes.

AntonLV hace 12 años
padre
commit
7e646c4ae2

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

@@ -77,7 +77,7 @@ class BxBaseModNotificationsConfig extends BxDolModuleConfig
                     $aHandler = array_merge($aHandler, $aContent);
             }
 
-           $this->_aHandlers[$aHandler['alert_unit'] . '_' . $aHandler['alert_action']] = $aHandler;
+           $this->_aHandlers[$aHandler['alert_unit'] . (!empty($aHandler['alert_action']) ? '_' . $aHandler['alert_action'] :'')] = $aHandler;
         }
 
         $sHideTimeline = getParam($sOptionPrefix . 'events_hide');

+ 6 - 2
modules/base/notifications/classes/BxBaseModNotificationsModule.php

@@ -59,11 +59,15 @@ class BxBaseModNotificationsModule extends BxDolModule
             if($aHandler['type'] != BX_BASE_MOD_NTFS_HANDLER_TYPE_INSERT)
                 continue;
 
-            $aModule = $this->_oDb->getModuleByName($aHandler['module_name']);
+			$aModule = array();
+			if(!empty($aHandler['module_name']))
+            	$aModule = $this->_oDb->getModuleByName($aHandler['module_name']);
+
             if(empty($aModule))
                 $aModule['title'] = _t($sLangPrefix . '_alert_module_' . $aHandler['alert_unit']);
 
-            $aResults[$aHandler['id']] = $aModule['title'] . ' (' . _t($sLangPrefix . '_alert_action_' . $aHandler['alert_action']) . ')';
+			$sAction = !empty($aHandler['alert_action']) ? ' (' . _t($sLangPrefix . '_alert_action_' . $aHandler['alert_action']) . ')' : '';
+            $aResults[$aHandler['id']] = $aModule['title'] . $sAction;
         }
 
         asort($aResults);

+ 4 - 24
modules/boonex/timeline/classes/BxTimelineDb.php

@@ -24,26 +24,6 @@ class BxTimelineDb extends BxBaseModNotificationsDb
         $this->_sTableSharesTrack = $this->_sPrefix . 'shares_track';
     }
 
-    public function getHandlers($aParams = array())
-    {
-        $sMethod = 'getAll';
-        $sWhereClause = '';
-
-        if(!empty($aParams))
-            switch($aParams['type']) {}
-
-        $sSql = "SELECT
-                `id` AS `id`,
-                `type` AS `type`,
-                `alert_unit` AS `alert_unit`,
-                `alert_action` AS `alert_action`,
-                `content` AS `content`
-            FROM `{$this->_sTableHandlers}`
-            WHERE 1 AND `alert_unit` NOT LIKE ('" . $this->_oConfig->getPrefix('common_post') . "%')" . $sWhereClause;
-
-        return $this->$sMethod($sSql);
-    }
-
     public function getMaxDuration($aParams)
     {
         $aParams['browse'] = 'last';
@@ -271,15 +251,15 @@ class BxTimelineDb extends BxBaseModNotificationsDb
 
 		//--- Apply modules or handlers filter
         $sWhereModuleFilter = '';
-        if(isset($aParams['modules']) && !empty($aParams['modules']) && is_array($aParams['modules']))
-        	$sWhereModuleFilter = "AND `type` IN (" . $this->implode_escape($aParams['modules']) . ") ";
+        if(!empty($aParams['modules']) && is_array($aParams['modules']))
+        	$sWhereModuleFilter = "AND `" . $this->_sTable . "`.`type` IN (" . $this->implode_escape($aParams['modules']) . ") ";
 
 		if($sWhereModuleFilter == '') {
         	$aHidden = $this->_oConfig->getHandlersHidden();
-			$sWhereModuleFilter = is_array($aHidden) && !empty($aHidden) ? "AND `th`.`id` NOT IN (" . $this->implode_escape($aHidden) . ") " : "";
+			$sWhereModuleFilter = !empty($aHidden) && is_array($aHidden) ? "AND `" . $this->_sTableHandlers . "`.`id` NOT IN (" . $this->implode_escape($aHidden) . ") " : "";
 		}
 
-		if($sWhereModuleFilter == '')
+		if($sWhereModuleFilter != '')
 			$sWhereClause .= $sWhereModuleFilter;
 
 		//--- Check type

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

@@ -19,9 +19,11 @@ define('BX_TIMELINE_FILTER_ALL', 'all');
 define('BX_TIMELINE_FILTER_OWNER', 'owner');
 define('BX_TIMELINE_FILTER_OTHER', 'other');
 
+/*
 define('BX_TIMELINE_PARSE_TYPE_TEXT', 'text');
 define('BX_TIMELINE_PARSE_TYPE_LINK', 'link');
 define('BX_TIMELINE_PARSE_TYPE_PHOTO', 'photo');
+*/
 
 define('BX_TIMELINE_PARSE_TYPE_POST', 'post');
 define('BX_TIMELINE_PARSE_TYPE_SHARE', 'share');

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

@@ -7,7 +7,7 @@
 	<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_rss_length"><![CDATA[The length of RSS feed]]></string>
-	<string name="_bx_timeline_option_events_hide"><![CDATA[Hide events from Timeline]]></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>
 	<string name="_bx_timeline_option_err_chars_display_max"><![CDATA[Enter the number which should be greater then 150.]]></string>
 
@@ -59,7 +59,6 @@
     <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_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>
@@ -77,6 +76,8 @@
     <string name="_bx_timeline_menu_item_title_system_timeline"><![CDATA[Timeline]]></string>
     <string name="_bx_timeline_menu_item_title_timeline"><![CDATA[Timeline]]></string>
 
+	<string name="_bx_timeline_alert_module_timeline_common_post"><![CDATA[Timeline (post)]]></string>
+	<string name="_bx_timeline_alert_module_timeline_common_share"><![CDATA[Timeline (share)]]></string>
 	<string name="_bx_timeline_alert_action_added"><![CDATA[add]]></string>
 
 	<string name="_bx_timeline_txt_msg_no_results"><![CDATA[Empty]]></string>
@@ -97,5 +98,4 @@
 	<string name="_bx_timeline_txt_shared_by"><![CDATA[Shared by]]></string>
 	<string name="_bx_timeline_txt_err_cannot_share"><![CDATA[Cannot share. Please report.]]></string>
 	<string name="_bx_timeline_txt_msg_success_share"><![CDATA[]]></string>	
-
 </resources>

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

@@ -61,7 +61,7 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 ('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', 'list', '', '', '', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:21:"get_actions_checklist";}', 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";}', 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);
 
 

+ 2 - 5
modules/boonex/timeline/install/sql/install.sql

@@ -33,11 +33,8 @@ CREATE TABLE IF NOT EXISTS `bx_timeline_handlers` (
 );
 
 INSERT INTO `bx_timeline_handlers`(`type`, `alert_unit`, `alert_action`, `content`) VALUES
-('insert', 'timeline_common_text', '', ''),
-('insert', 'timeline_common_link', '', ''),
-('insert', 'timeline_common_photos', '', ''),
-('insert', 'timeline_common_sounds', '', ''),
-('insert', 'timeline_common_videos', '', '');
+('insert', 'timeline_common_post', '', ''),
+('insert', 'timeline_common_share', '', '');
 
 -- TABLES: UPLOADERS
 CREATE TABLE IF NOT EXISTS `bx_timeline_photos` (