Bläddra i källkod

#103 combined actions menu in submenu

Alex Trofimov 11 år sedan
förälder
incheckning
b1459f2b29

+ 24 - 0
modules/base/general/classes/BxBaseModGeneralMenuView.php

@@ -50,6 +50,30 @@ class BxBaseModGeneralMenuView extends BxTemplMenu
 
         return true;
     }
+
+    protected function _getMenuItemsCombined ()
+    {
+        // combile values from ACTIONS_VIEW_ENTRY and ACTIONS_VIEW_ENTRY_MORE menus
+        $CNF = $this->_oModule->_oConfig->CNF;
+
+        if (empty($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY']))
+            return array();
+
+        $aItems = $this->_oQuery->getMenuItemsFromSet($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY']);
+        
+        if (empty($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']))
+            return $aItems;
+
+        $aItemsMore = $this->_oQuery->getMenuItemsFromSet($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']);
+        
+        // remove "more" item from ACTIONS_VIEW_ENTRY
+        $aItems = array_filter ($aItems, function ($aItem) {
+            return $aItem['order'] != BX_MENU_LAST_ITEM_ORDER;
+        });
+
+        // return combined array
+        return array_merge($aItems, $aItemsMore);
+    }
 }
 
 /** @} */

+ 2 - 21
modules/base/profile/classes/BxBaseModProfileMenuViewActions.php

@@ -10,32 +10,13 @@
  */
 
 /**
- * View profile entry actions menu n popup
+ * View entry actions menu in popup
  */
 class BxBaseModProfileMenuViewActions extends BxBaseModProfileMenuView
 {
     protected function getMenuItemsRaw ()
     {
-        // combile values from ACTIONS_VIEW_ENTRY and ACTIONS_VIEW_ENTRY_MORE menus
-        $CNF = $this->_oModule->_oConfig->CNF;
-
-        if (empty($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY']))
-            return array();
-
-        $aItems = $this->_oQuery->getMenuItemsFromSet($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY']);
-        
-        if (empty($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']))
-            return $aItems;
-
-        $aItemsMore = $this->_oQuery->getMenuItemsFromSet($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']);
-        
-        // remove "more" item from ACTIONS_VIEW_ENTRY
-        $aItems = array_filter ($aItems, function ($aItem) {
-            return $aItem['order'] != BX_MENU_LAST_ITEM_ORDER;
-        });
-
-        // return combined array
-        return array_merge($aItems, $aItemsMore);
+        return $this->_getMenuItemsCombined ();
     }
 }
 

+ 2 - 0
modules/boonex/organizations/classes/BxOrgsConfig.php

@@ -80,6 +80,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_organization_delete',
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_organizations_view_actions', // actions menu on view entry page
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_organizations_view_actions_more', // actions menu on view entry page for "more" popup
+            'OBJECT_MENU_ACTIONS_VIEW_ENTRY_POPUP' => 'bx_organizations_view_actions_popup', // actions menu popup on view entry page
             'OBJECT_MENU_SUBMENU' => 'bx_organizations_submenu', // main module submenu
             'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_organizations_view_submenu',  // view entry submenu
             'OBJECT_MENU_SUBMENU_VIEW_ENTRY_COVER' => 'bx_organizations_view_submenu_cover',  // view entry submenu displayed in cover
@@ -95,6 +96,7 @@ class BxOrgsConfig extends BxBaseModProfileConfig
             'MENU_ITEM_TO_METHOD' => array (
                 'bx_organizations_view_actions' => $aMenuItems2Methods,
                 'bx_organizations_view_actions_more' => $aMenuItems2Methods,
+                'bx_organizations_view_actions_popup' => $aMenuItems2Methods,
             ),
 
             // informer messages

+ 25 - 0
modules/boonex/organizations/classes/BxOrgsMenuViewActions.php

@@ -0,0 +1,25 @@
+<?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    Organizations Organizations
+ * @ingroup     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * Actions popup menu.
+ */
+class BxOrgsMenuViewActions extends BxBaseModProfileMenuViewActions
+{
+
+    public function __construct($aObject, $oTemplate = false)
+    {
+        $this->MODULE = 'bx_organizations';
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 1 - 0
modules/boonex/organizations/install/langs/en.xml

@@ -95,6 +95,7 @@
     <string name="_bx_orgs_menu_title_view_profile_actions"><![CDATA[Organization Actions]]></string>
     <string name="_bx_orgs_menu_set_title_view_profile_actions_more"><![CDATA[Organization More Actions]]></string>
     <string name="_bx_orgs_menu_title_view_profile_actions_more"><![CDATA[Organization More Actions]]></string>
+    <string name="_bx_orgs_menu_title_view_profile_actions_popup"><![CDATA[Organization Popup Actions]]></string>
     <string name="_bx_orgs_menu_set_title_view_profile_submenu"><![CDATA[View Organization Submenu]]></string>
     <string name="_bx_orgs_menu_title_view_profile_submenu"><![CDATA[View Organization Submenu]]></string>
     <string name="_bx_orgs_menu_title_view_profile_submenu_cover"><![CDATA[Organization Cover Submenu]]></string>

+ 3 - 2
modules/boonex/organizations/install/sql/enable.sql

@@ -143,7 +143,8 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
 -- MENU: view actions
 
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
-('bx_organizations_view_actions', '_bx_orgs_menu_title_view_profile_actions', 'bx_organizations_view_actions', 'bx_organizations', 9, 0, 1, 'BxOrgsMenuView', 'modules/boonex/organizations/classes/BxOrgsMenuView.php');
+('bx_organizations_view_actions', '_bx_orgs_menu_title_view_profile_actions', 'bx_organizations_view_actions', 'bx_organizations', 9, 0, 1, 'BxOrgsMenuView', 'modules/boonex/organizations/classes/BxOrgsMenuView.php'),
+('bx_organizations_view_actions_popup', '_bx_orgs_menu_title_view_profile_actions_popup', '', 'bx_organizations', 16, 0, 1, 'BxOrgsMenuViewActions', 'modules/boonex/organizations/classes/BxOrgsMenuViewActions.php');
 
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_organizations_view_actions', 'bx_organizations', '_bx_orgs_menu_set_title_view_profile_actions', 0);
@@ -151,7 +152,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 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_organizations_view_actions', 'bx_organizations', 'profile-friend-add', '_bx_orgs_menu_item_title_system_befriend', '{title_add_friend}', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_friends\', \'add\', \'{profile_id}\')', '', 'user-plus', '', 2147483647, 1, 0, 10),
 ('bx_organizations_view_actions', 'bx_organizations', 'profile-subscribe-add', '_bx_orgs_menu_item_title_system_subscribe', '_bx_orgs_menu_item_title_subscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'add\', \'{profile_id}\')', '', 'check', '', 2147483647, 1, 0, 20),
-('bx_organizations_view_actions', 'bx_organizations', 'profile-set-acl-level', '_sys_menu_item_title_system_set_acl_level', '_sys_menu_item_title_set_acl_level', 'javascript:void(0)', 'bx_menu_popup(''sys_set_acl_level'', window, {}, {profile_id: {profile_id}});', '', 'certificate', '', 192, 1, 0, 1000),
+('bx_organizations_view_actions', 'bx_organizations', 'profile-set-acl-level', '_sys_menu_item_title_system_set_acl_level', '_sys_menu_item_title_set_acl_level', 'javascript:void(0)', 'bx_menu_popup(''sys_set_acl_level'', window, {}, {profile_id: {profile_id}});', '', 'certificate', '', 192, 1, 0, 30),
 ('bx_organizations_view_actions', 'bx_organizations', 'profile-actions-more', '_bx_orgs_menu_item_title_system_more_actions', '_bx_orgs_menu_item_title_more_actions', 'javascript:void(0)', 'bx_menu_popup(''bx_organizations_view_actions_more'', this, {}, {profile_id:{profile_id}});', '', 'cog', 'bx_organizations_view_actions_more', 2147483647, 1, 0, 9999);
 
 -- MENU: view actions more

+ 2 - 0
modules/boonex/persons/classes/BxPersonsConfig.php

@@ -80,6 +80,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_person_delete',
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_persons_view_actions', // actions menu on view entry page
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_persons_view_actions_more', // actions menu on view entry page for "more" popup
+            'OBJECT_MENU_ACTIONS_VIEW_ENTRY_POPUP' => 'bx_persons_view_actions_popup', // actions menu popup on view entry page 
             'OBJECT_MENU_SUBMENU' => 'bx_persons_submenu', // main module submenu
             'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_persons_view_submenu',  // view entry submenu
             'OBJECT_MENU_SUBMENU_VIEW_ENTRY_COVER' => 'bx_persons_view_submenu_cover',  // view entry submenu displayed in cover
@@ -95,6 +96,7 @@ class BxPersonsConfig extends BxBaseModProfileConfig
             'MENU_ITEM_TO_METHOD' => array (
                 'bx_persons_view_actions' => $aMenuItems2Methods,
                 'bx_persons_view_actions_more' => $aMenuItems2Methods,
+                'bx_persons_view_actions_popup' => $aMenuItems2Methods,
             ),
 
             // informer messages

+ 25 - 0
modules/boonex/persons/classes/BxPersonsMenuViewActions.php

@@ -0,0 +1,25 @@
+<?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     TridentModules
+ *
+ * @{
+ */
+
+/**
+ * Actions popup menu.
+ */
+class BxPersonsMenuViewActions extends BxBaseModProfileMenuViewActions
+{
+
+    public function __construct($aObject, $oTemplate = false)
+    {
+        $this->MODULE = 'bx_persons';
+        parent::__construct($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 1 - 0
modules/boonex/persons/install/langs/en.xml

@@ -90,6 +90,7 @@
     <string name="_bx_persons_menu_title_view_profile_actions"><![CDATA[Person Actions]]></string>
     <string name="_bx_persons_menu_set_title_view_profile_actions_more"><![CDATA[Person More Actions]]></string>
     <string name="_bx_persons_menu_title_view_profile_actions_more"><![CDATA[Person More Actions]]></string>
+    <string name="_bx_persons_menu_title_view_profile_actions_popup"><![CDATA[Person Popup Actions]]></string>
     <string name="_bx_persons_menu_set_title_view_profile_submenu"><![CDATA[View Person Submenu]]></string>
     <string name="_bx_persons_menu_title_view_profile_submenu"><![CDATA[View Person Submenu]]></string>
     <string name="_bx_persons_menu_title_view_profile_submenu_cover"><![CDATA[Person Cover Submenu]]></string>

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

@@ -138,7 +138,8 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
 -- MENU: view actions
 
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
-('bx_persons_view_actions', '_bx_persons_menu_title_view_profile_actions', 'bx_persons_view_actions', 'bx_persons', 9, 0, 1, 'BxPersonsMenuView', 'modules/boonex/persons/classes/BxPersonsMenuView.php');
+('bx_persons_view_actions', '_bx_persons_menu_title_view_profile_actions', 'bx_persons_view_actions', 'bx_persons', 9, 0, 1, 'BxPersonsMenuView', 'modules/boonex/persons/classes/BxPersonsMenuView.php'),
+('bx_persons_view_actions_popup', '_bx_persons_menu_title_view_profile_actions_popup', '', 'bx_persons', 16, 0, 1, 'BxPersonsMenuViewActions', 'modules/boonex/persons/classes/BxPersonsMenuViewActions.php');
 
 INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
 ('bx_persons_view_actions', 'bx_persons', '_bx_persons_menu_set_title_view_profile_actions', 0);
@@ -146,7 +147,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 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_view_actions', 'bx_persons', 'profile-friend-add', '_bx_persons_menu_item_title_system_befriend', '{title_add_friend}', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_friends\', \'add\', \'{profile_id}\')', '', 'user-plus', '', 2147483647, 1, 0, 10),
 ('bx_persons_view_actions', 'bx_persons', 'profile-subscribe-add', '_bx_persons_menu_item_title_system_subscribe', '_bx_persons_menu_item_title_subscribe', 'javascript:void(0)', 'bx_conn_action(this, \'sys_profiles_subscriptions\', \'add\', \'{profile_id}\')', '', 'check', '', 2147483647, 1, 0, 20),
-('bx_persons_view_actions', 'bx_persons', 'profile-set-acl-level', '_sys_menu_item_title_system_set_acl_level', '_sys_menu_item_title_set_acl_level', 'javascript:void(0)', 'bx_menu_popup(''sys_set_acl_level'', window, {}, {profile_id: {profile_id}});', '', 'certificate', '', 192, 1, 0, 1000),
+('bx_persons_view_actions', 'bx_persons', 'profile-set-acl-level', '_sys_menu_item_title_system_set_acl_level', '_sys_menu_item_title_set_acl_level', 'javascript:void(0)', 'bx_menu_popup(''sys_set_acl_level'', window, {}, {profile_id: {profile_id}});', '', 'certificate', '', 192, 1, 0, 30),
 ('bx_persons_view_actions', 'bx_persons', 'profile-actions-more', '_bx_persons_menu_item_title_system_more_actions', '_bx_persons_menu_item_title_more_actions', 'javascript:void(0)', 'bx_menu_popup(''bx_persons_view_actions_more'', this, {}, {profile_id:{profile_id}});', '', 'cog', 'bx_persons_view_actions_more', 2147483647, 1, 0, 9999);
 
 -- MENU: view actions more

+ 1 - 0
modules/boonex/russian/data/langs/bx_organizations/ru.xml

@@ -94,6 +94,7 @@
     <string name="_bx_orgs_menu_title_view_profile_actions"><![CDATA[Организации - Действия]]></string>
     <string name="_bx_orgs_menu_set_title_view_profile_actions_more"><![CDATA[Организации - Дополнительные Действия]]></string>
     <string name="_bx_orgs_menu_title_view_profile_actions_more"><![CDATA[Организации - Дополнительные Действия]]></string>
+    <string name="_bx_orgs_menu_title_view_profile_actions_popup"><![CDATA[Организации - Всплывающие действия]]></string>
     <string name="_bx_orgs_menu_set_title_view_profile_submenu"><![CDATA[Подменю просмотра организации]]></string>
     <string name="_bx_orgs_menu_title_view_profile_submenu"><![CDATA[Подменю просмотра организации]]></string>
     <string name="_bx_orgs_menu_title_view_profile_submenu_cover"><![CDATA[Подменю организации на обложке]]></string>

+ 1 - 0
modules/boonex/russian/data/langs/bx_persons/ru.xml

@@ -90,6 +90,7 @@
     <string name="_bx_persons_menu_title_view_profile_actions"><![CDATA[Персоны - Действия]]></string>
     <string name="_bx_persons_menu_set_title_view_profile_actions_more"><![CDATA[Персоны - Дополнительные действия]]></string>
     <string name="_bx_persons_menu_title_view_profile_actions_more"><![CDATA[Персоны - Дополнительные действия]]></string>
+    <string name="_bx_persons_menu_title_view_profile_actions_popup"><![CDATA[Персоны - Всплывающие действия]]></string>
     <string name="_bx_persons_menu_set_title_view_profile_submenu"><![CDATA[Подменю просмотра персоны]]></string>
     <string name="_bx_persons_menu_title_view_profile_submenu"><![CDATA[Подменю просмотра персоны]]></string>
     <string name="_bx_persons_menu_title_view_profile_submenu_cover"><![CDATA[Подменю персоны на обложке]]></string>