Răsfoiți Sursa

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

Alex Trofimov 12 ani în urmă
părinte
comite
0b495917e2

+ 2 - 1
modules/base/general/classes/BxBaseModGeneralGridAdministration.php

@@ -34,6 +34,7 @@ class BxBaseModGeneralGridAdministration extends BxTemplGrid
         if(empty($sFilterName) || empty($aFilterValues))
             return '';
 
+		$sName = $this->_oModule->_oConfig->getName();
 		$sJsObject = $this->_oModule->_oConfig->getJsObject('manage_tools');
 
 		$sFilterField = '_s' . str_replace(' ', '', ucwords(str_replace('_', ' ', $sFilterName)));
@@ -48,7 +49,7 @@ class BxBaseModGeneralGridAdministration extends BxTemplGrid
                 'onChange' => 'javascript:' . $sJsObject . '.onChangeFilter(this)'
             ),
             'value' => $this->$sFilterField,
-            'values' => array_merge(array('' => _t('_bx_persons_grid_filter_item_title_adm_select_one')), $aFilterValues)
+            'values' => array_merge(array('' => _t('_' . $sName . '_grid_filter_item_title_adm_select_one')), $aFilterValues)
         );
 
         bx_import('BxTemplFormView');

+ 1 - 1
modules/base/general/classes/BxBaseModGeneralTemplate.php

@@ -34,7 +34,7 @@ class BxBaseModGeneralTemplate extends BxDolModuleTemplate
             'sActionUri' => $sBaseUri,
             'sActionUrl' => BX_DOL_URL_ROOT . $sBaseUri,
             'sObjName' => $sJsObject,
-        	'sObjNameGrid' => '',
+        	'aHtmlIds' => array(),
             'oRequestParams' => array()
         ), $aParams);
         $sContent = "var " . $sJsObject . " = new " . $sJsClass . "(" . json_encode($aParams) . ");";

+ 8 - 14
modules/base/notifications/classes/BxBaseModNotificationsTemplate.php

@@ -9,9 +9,9 @@
  * @{
  */
 
-bx_import('BxDolModuleTemplate');
+bx_import('BxBaseModGeneralTemplate');
 
-class BxBaseModNotificationsTemplate extends BxDolModuleTemplate
+class BxBaseModNotificationsTemplate extends BxBaseModGeneralTemplate
 {
 	function __construct(&$oConfig, &$oDb)
     {
@@ -32,7 +32,7 @@ class BxBaseModNotificationsTemplate extends BxDolModuleTemplate
         ));
     }
 
-	public function getJsCode($sType, $aRequestParams = array(), $bWrap = true)
+	public function getJsCode($sType, $aParams = array(), $bWrap = true)
     {
         $oModule = $this->getModule();
 
@@ -40,21 +40,15 @@ class BxBaseModNotificationsTemplate extends BxDolModuleTemplate
         $sJsClass = $this->_oConfig->getJsClass($sType);
         $sJsObject = $this->_oConfig->getJsObject($sType);
 
-        $aParams = array(
-            'sActionUri' => $sBaseUri,
-            'sActionUrl' => BX_DOL_URL_ROOT . $sBaseUri,
-            'sObjName' => $sJsObject,
-            'iOwnerId' => $oModule->_iOwnerId,
+        $aParams = array_merge(array(
+        	'iOwnerId' => $oModule->_iOwnerId,
             'sAnimationEffect' => $this->_oConfig->getAnimationEffect(),
             'iAnimationSpeed' => $this->_oConfig->getAnimationSpeed(),
-            'aHtmlIds' => $this->_oConfig->getHtmlIds($sType),
-            'oRequestParams' => !empty($aRequestParams) ? $aRequestParams : array()
-        );
-
-        $sContent = "var " . $sJsObject . " = new " . $sJsClass . "(" . json_encode($aParams) . ");";
+            'aHtmlIds' => $this->_oConfig->getHtmlIds($sType)
+        ), $aParams);
 
         $this->getCssJs();
-        return !$bWrap ? $sContent : $this->_wrapInTagJsCode($sContent);
+        return parent::getJsCode($sType, $aParams, $bWrap);
     }
 
 	protected function getModule()

+ 1 - 1
modules/base/profile/classes/BxBaseModProfileGridAdministration.php

@@ -91,7 +91,7 @@ class BxBaseModProfileGridAdministration extends BxBaseModGeneralGridAdministrat
         $this->_echoResultJson($iAffected ? array('grid' => $this->getCode(false), 'blink' => $aIdsAffected) : array('msg' => _t('_adm_nav_err_menus_delete')));
     }
 
-	public function performActionDeleteSpammer()
+	public function performActionDeleteWithContent()
     {
     	$this->performActionDelete(true);
     }

+ 6 - 0
modules/boonex/notifications/classes/BxNtfsConfig.php

@@ -21,6 +21,12 @@ class BxNtfsConfig extends BxBaseModNotificationsConfig
     {
         parent::__construct($aModule);
 
+        $this->CNF = array (
+        	'URL_HOME' => 'page.php?i=notifications-view',
+
+        	'OBJECT_MENU_SUBMENU' => 'bx_notifications_submenu', // main module submenu
+        );
+        
 		$this->_aPrefixes = array(
         	'style' => 'bx-ntfs',
         	'language' => '_bx_ntfs',

+ 21 - 0
modules/boonex/notifications/classes/BxNtfsModule.php

@@ -78,6 +78,27 @@ class BxNtfsModule extends BxBaseModNotificationsModule
     /*
      * COMMON METHODS
      */
+    public function setSubmenu($sSelected)
+    {
+    	bx_import('BxDolMenu');
+    	$oSubmenuSystem = BxDolMenu::getObjectInstance('sys_site_submenu');
+        if(!$oSubmenuSystem)
+			return;
+
+		$CNF = &$this->_oConfig->CNF;
+
+		bx_import('BxDolPermalinks');
+        $oSubmenuSystem->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU'], array (
+            'title' => _t('_bx_ntfs'),
+            'link' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($CNF['URL_HOME']),
+            'icon' => '',
+        ));
+
+        $oSubmenuModule = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SUBMENU']);
+        if($oSubmenuModule)
+			$oSubmenuModule->setSelected($this->_oConfig->getName(), $sSelected);
+    }
+
     public function onPost($iId)
     {
     	//--- Event -> Post for Alerts Engine ---//

+ 9 - 9
modules/boonex/notifications/classes/BxNtfsPageView.php

@@ -9,23 +9,23 @@
  * @{
  */
 
-bx_import('BxTemplPageDashboard');
+bx_import('BxDolMenu');
+bx_import('BxDolModule');
+bx_import('BxTemplPage');
 
-/**
- * Entry create/edit pages
- */
-class BxNtfsPageView extends BxTemplPageDashboard
+class BxNtfsPageView extends BxTemplPage
 {
-	protected $sModule;
+	protected $_sModule;
+	protected $_oModule;
 
     public function __construct($aObject, $oTemplate = false)
     {
         parent::__construct($aObject, $oTemplate);
 
-    	$this->sModule = 'bx_notifications';        
+    	$this->_sModule = 'bx_notifications';
+		$this->_oModule = BxDolModule::getInstance($this->_sModule);
 
-    	bx_import('BxDolMenu');
-        BxDolMenu::getObjectInstance('sys_account_dashboard_submenu')->setSelected($this->sModule, 'account-dashboard-notifications');
+		$this->_oModule->setSubmenu('notifications-all');
     }
 }
 

+ 7 - 5
modules/boonex/notifications/classes/BxNtfsTemplate.php

@@ -26,11 +26,13 @@ class BxNtfsTemplate extends BxBaseModNotificationsTemplate
             'style_prefix' => $this->_oConfig->getPrefix('style'),
             'content' => $this->getPosts($aParams),
             'js_content' => $this->getJsCode('view', array(
-                'type' => $aParams['type'],
-                'owner_id' => $aParams['owner_id'],
-                'start' => $aParams['start'],
-                'per_page' => $aParams['per_page'],
-                'modules' => $aParams['modules']
+        		'oRequestParams' => array(
+	                'type' => $aParams['type'],
+	                'owner_id' => $aParams['owner_id'],
+	                'start' => $aParams['start'],
+	                'per_page' => $aParams['per_page'],
+	                'modules' => $aParams['modules']
+       			)
             ))
         ));
     }

+ 4 - 0
modules/boonex/notifications/install/langs/en.xml

@@ -6,6 +6,10 @@
 	<string name="_bx_ntfs_page_title_view"><![CDATA[Notifications]]></string>
 	<string name="_bx_ntfs_page_block_title_view"><![CDATA[Notifications]]></string>
 
+	<string name="_bx_ntfs_menu_title_submenu"><![CDATA[Notifications Submenu]]></string>
+	<string name="_bx_ntfs_menu_set_title_submenu"><![CDATA[Notifications Submenu]]></string>
+	<string name="_bx_ntfs_menu_item_title_system_notifications_all"><![CDATA[All Notifications]]></string>
+	<string name="_bx_ntfs_menu_item_title_notifications_all"><![CDATA[All Notifications]]></string>
     <string name="_bx_ntfs_menu_item_title_system_notifications"><![CDATA[Notifications]]></string>
     <string name="_bx_ntfs_menu_item_title_notifications"><![CDATA[Notifications]]></string>
 

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

@@ -7,6 +7,8 @@ DELETE FROM `sys_pages_blocks` WHERE `module` = @sName;
 
 
 -- MENU
+DELETE FROM `sys_objects_menu` WHERE `module` = @sName;
+DELETE FROM `sys_menu_sets` WHERE `module` = @sName;
 DELETE FROM `sys_menu_items` WHERE `module` = @sName;
 
 

+ 9 - 4
modules/boonex/notifications/install/sql/enable.sql

@@ -9,10 +9,15 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designb
 ('bx_notifications_view', 1, @sName, '_bx_ntfs_page_block_title_view', 11, 2147483647, 'service', 'a:2:{s:6:"module";s:16:"bx_notifications";s:6:"method";s:14:"get_block_view";}', 0, 1, 1);
 
 
--- MENU: Dashboard
-SET @iMIOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name` = 'sys_account_dashboard');
-INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES
-('sys_account_dashboard', @sName, 'account-dashboard-notifications', '_bx_ntfs_menu_item_title_system_notifications', '_bx_ntfs_menu_item_title_notifications', 'page.php?i=notifications-view', '', '', 'bell col-green3', '', '', 2147483646, 1, 0, @iMIOrder + 1);
+-- MENU: module sub-menu
+INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
+('bx_notifications_submenu', '_bx_ntfs_menu_title_submenu', 'bx_notifications_submenu', @sName, 8, 0, 1, '', '');
+
+INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
+('bx_notifications_submenu', @sName, '_bx_ntfs_menu_set_title_submenu', 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_notifications_submenu', @sName, 'notifications-all', '_bx_ntfs_menu_item_title_system_notifications_all', '_bx_ntfs_menu_item_title_notifications_all', 'page.php?i=notifications-view', '', '', '', '', 2147483647, 1, 0, 1);
 
 -- MENU: Notifications
 SET @iMIOrder = (SELECT IFNULL(MAX(`order`), 0) FROM `sys_menu_items` WHERE `set_name` = 'sys_account_notifications');

+ 5 - 4
modules/boonex/persons/install/langs/en.xml

@@ -87,8 +87,8 @@
     <string name="_bx_persons_menu_title_view_profile_submenu"><![CDATA[View Person Submenu]]></string>
 	<string name="_bx_persons_menu_set_title_manage_tools"><![CDATA[Manage Tools Submenu]]></string>
     <string name="_bx_persons_menu_title_manage_tools"><![CDATA[Manage Tools Submenu]]></string>
-    <string name="_bx_persons_menu_item_title_system_delete_spammer"><![CDATA[Delete Spammer]]></string>
-    <string name="_bx_persons_menu_item_title_delete_spammer"><![CDATA[Delete Spammer]]></string>
+    <string name="_bx_persons_menu_item_title_system_delete_with_content"><![CDATA[Delete With Content]]></string>
+    <string name="_bx_persons_menu_item_title_delete_with_content"><![CDATA[Delete With Content]]></string>
     <string name="_bx_persons_menu_item_title_system_edit_profile"><![CDATA[Edit Person]]></string>
     <string name="_bx_persons_menu_item_title_edit_profile"><![CDATA[Edit Profile]]></string>
     <string name="_bx_persons_menu_item_title_system_delete_profile"><![CDATA[Delete Person]]></string>
@@ -128,15 +128,16 @@
     <string name="_bx_persons_menu_item_title_system_entries_home"><![CDATA[Persons]]></string>
     <string name="_bx_persons_menu_item_title_entries_home"><![CDATA[People]]></string>
 
-	<string name="_bx_persons_grid_filter_item_title_adm_select_one"><![CDATA[Select One]]></string>
+	<string name="_bx_persons_grid_filter_item_title_adm_select_one"><![CDATA[Select Status...]]></string>
 	<string name="_bx_persons_grid_filter_item_title_adm_active"><![CDATA[Active]]></string>
 	<string name="_bx_persons_grid_filter_item_title_adm_pending"><![CDATA[Pending]]></string>
 	<string name="_bx_persons_grid_filter_item_title_adm_suspended"><![CDATA[Suspended]]></string>
+	<string name="_bx_persons_grid_column_title_adm_active"><![CDATA[Active]]></string>
     <string name="_bx_persons_grid_column_title_adm_fullname"><![CDATA[Name]]></string>
     <string name="_bx_persons_grid_column_title_adm_last_online"><![CDATA[Last Online]]></string>
     <string name="_bx_persons_grid_column_title_adm_account"><![CDATA[Account]]></string>
     <string name="_bx_persons_grid_action_title_adm_delete"><![CDATA[Delete]]></string>
-    <string name="_bx_persons_grid_action_title_adm_delete_spammer"><![CDATA[Delete Spammer]]></string>
+    <string name="_bx_persons_grid_action_title_adm_delete_with_content"><![CDATA[Delete With Content]]></string>
     <string name="_bx_persons_grid_action_title_adm_set_acl_level"><![CDATA[Set Membership]]></string>
 
     <string name="_bx_persons_txt_account_pending"><![CDATA[This profile is pending approval, please wait until it is activated.]]></string>

+ 3 - 3
modules/boonex/persons/install/sql/enable.sql

@@ -198,7 +198,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_persons_menu_manage_tools', 'bx_persons', '_bx_persons_menu_set_title_manage_tools', 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_persons_menu_manage_tools', 'bx_persons', 'delete_spammer', '_bx_persons_menu_item_title_system_delete_spammer', '_bx_persons_menu_item_title_delete_spammer', 'javascript:void(0)', 'javascript:{js_object}.onClickDeleteSpammer({content_id});', '_self', 'trash-o', '', 128, 1, 0, 0);
+('bx_persons_menu_manage_tools', 'bx_persons', 'delete-with-content', '_bx_persons_menu_item_title_system_delete_with_content', '_bx_persons_menu_item_title_delete_with_content', 'javascript:void(0)', 'javascript:{js_object}.onClickDeleteWithContent({content_id});', '_self', 'trash-o', '', 128, 1, 0, 0);
 
 
 -- ACL
@@ -281,7 +281,7 @@ INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `fie
 
 INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
 ('bx_persons_administration', 'checkbox', '_sys_select', '2%', 0, '', '', 1),
-('bx_persons_administration', 'switcher', '', '8%', 0, '', '', 2),
+('bx_persons_administration', 'switcher', '_bx_persons_grid_column_title_adm_active', '8%', 0, '', '', 2),
 ('bx_persons_administration', 'fullname', '_bx_persons_grid_column_title_adm_fullname', '25%', 0, '', '', 3),
 ('bx_persons_administration', 'last_online', '_bx_persons_grid_column_title_adm_last_online', '20%', 1, '25', '', 4),
 ('bx_persons_administration', 'account', '_bx_persons_grid_column_title_adm_account', '25%', 0, '25', '', 5),
@@ -295,7 +295,7 @@ INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `confirm`, `order`) VALUES
 ('bx_persons_administration', 'bulk', 'set_acl_level', '_bx_persons_grid_action_title_adm_set_acl_level', '', 0, 1),
 ('bx_persons_administration', 'bulk', 'delete', '_bx_persons_grid_action_title_adm_delete', '', 1, 2),
-('bx_persons_administration', 'bulk', 'delete_spammer', '_bx_persons_grid_action_title_adm_delete_spammer', '', 1, 3),
+('bx_persons_administration', 'bulk', 'delete_with_content', '_bx_persons_grid_action_title_adm_delete_with_content', '', 1, 3),
 ('bx_persons_administration', 'single', 'set_acl_level', '', 'certificate', 0, 1),
 ('bx_persons_administration', 'single', 'delete', '', 'remove', 1, 2),
 ('bx_persons_administration', 'single', 'settings', '', 'cog', 0, 3),

+ 2 - 2
modules/boonex/persons/js/manage_tools.js

@@ -40,8 +40,8 @@ BxPersonsManageTools.prototype.onClickSettings = function(sMenuObject, oButton)
 	});
 };
 
-BxPersonsManageTools.prototype.onClickDeleteSpammer = function(iContentId) {
-	glGrids[this._sObjNameGrid].actionWithId(iContentId, 'delete_spammer', {}, '', false, 1);
+BxPersonsManageTools.prototype.onClickDeleteWithContent = function(iContentId) {
+	glGrids[this._sObjNameGrid].actionWithId(iContentId, 'delete_with_content', {}, '', false, 1);
 };
 
 /** @} */

+ 11 - 9
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -45,8 +45,8 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             'style_prefix' => $this->_oConfig->getPrefix('style'),
             'js_object' => $this->_oConfig->getJsObject('post'),
             'js_content' => $this->getJsCode('post', array(
-                'owner_id' => $iOwnerId
-            )),
+            	'oRequestParams' => array('owner_id' => $iOwnerId)
+        	)),
             'form' => $aForm['form']
         ));
     }
@@ -63,13 +63,15 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             'load_more' =>  $sLoadMore,
         	'view_image_popup' => $this->_getImagePopup(),
             'js_content' => $this->getJsCode('view', array(
-                'type' => $aParams['type'],
-                'owner_id' => $aParams['owner_id'],
-                'start' => $aParams['start'],
-                'per_page' => $aParams['per_page'],
-                'filter' => $aParams['filter'],
-                'modules' => $aParams['modules'],
-                'timeline' => $aParams['timeline'],
+            	'oRequestParams' => array(
+	                'type' => $aParams['type'],
+	                'owner_id' => $aParams['owner_id'],
+	                'start' => $aParams['start'],
+	                'per_page' => $aParams['per_page'],
+	                'filter' => $aParams['filter'],
+	                'modules' => $aParams['modules'],
+	                'timeline' => $aParams['timeline'],
+        		)
             )) . $this->getJsCode('share')
         ));
     }