Bläddra i källkod

Ticket #1524 - Usage in Market module.

AntonLV 8 år sedan
förälder
incheckning
d1821873b0

+ 21 - 0
modules/base/general/classes/BxBaseModGeneralMenuViewActions.php

@@ -18,6 +18,7 @@ class BxBaseModGeneralMenuViewActions extends BxTemplMenuCustom
     protected $_oModule;
 
     protected $_oMenuAction;
+    protected $_oMenuActionsMore;
     protected $_oMenuSocialSharing;
 
     protected $_iContentId;
@@ -36,6 +37,7 @@ class BxBaseModGeneralMenuViewActions extends BxTemplMenuCustom
         $this->setContentId(bx_process_input(bx_get('id'), BX_DATA_INT));
 
         $this->_oMenuActions = null;
+        $this->_oMenuActionsMore = null;
         $this->_oMenuSocialSharing = null;
 
         $this->_bShowAsButton = true;
@@ -235,6 +237,25 @@ class BxBaseModGeneralMenuViewActions extends BxTemplMenuCustom
 
         return $this->_getMenuItemDefault($aItem);
     }
+
+    protected function _getMenuItemByNameActionsMore($aItem)
+    {
+        $CNF = &$this->_oModule->_oConfig->CNF;
+
+        if(empty($this->_oMenuActionsMore)) {
+            if(empty($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']))
+                return '';
+
+            $this->_oMenuActionsMore = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']);
+            $this->_oMenuActionsMore->setContentId($this->_iContentId);
+        }
+
+        $aItem = $this->_oMenuActionsMore->getMenuItem($aItem['name']);
+        if(empty($aItem) || !is_array($aItem))
+            return false;
+
+        return $this->_getMenuItemDefault($aItem);
+    }
 }
 
 /** @} */

+ 0 - 26
modules/boonex/forum/classes/BxForumMenuViewActions.php

@@ -14,18 +14,11 @@
  */
 class BxForumMenuViewActions extends BxBaseModTextMenuViewActions
 {
-    protected $_oMenuActionsMore;
-    
-    protected $_sMenuItemCode;
-    protected $_aMenuItemParams;
-
     public function __construct($aObject, $oTemplate = false)
     {
         $this->_sModule = 'bx_forum';
 
         parent::__construct($aObject, $oTemplate);
-
-        $this->_oMenuActionsMore = null;
     }
 
     protected function _getMenuItemSubscribeDiscussion($aItem)
@@ -77,25 +70,6 @@ class BxForumMenuViewActions extends BxBaseModTextMenuViewActions
     {
         return $this->_getMenuItemByNameActionsMore($aItem);
     }
-
-    protected function _getMenuItemByNameActionsMore($aItem)
-    {
-        $CNF = &$this->_oModule->_oConfig->CNF;
-
-        if(empty($this->_oMenuActionsMore)) {
-            if(empty($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']))
-                return '';
-
-            $this->_oMenuActionsMore = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']);
-            $this->_oMenuActionsMore->setContentId($this->_iContentId);
-        }
-
-        $aItem = $this->_oMenuActionsMore->getMenuItem($aItem['name']);
-        if(empty($aItem) || !is_array($aItem))
-            return false;
-
-        return $this->_getMenuItemDefault($aItem);
-    }
 }
 
 /** @} */

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

@@ -17,7 +17,7 @@ DELETE FROM `sys_pages_blocks` WHERE `module` = @sName OR `object` LIKE 'bx_foru
 -- 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 OR `set_name` IN('bx_forum_view', 'bx_forum_view_actions', 'bx_forum_view_more', 'bx_forum_submenu', 'bx_forum_my', 'bx_forum_menu_manage_tools');
+DELETE FROM `sys_menu_items` WHERE `module` = @sName OR `set_name` IN('bx_forum_view', 'bx_forum_view_more', 'bx_forum_view_actions', 'bx_forum_submenu', 'bx_forum_my', 'bx_forum_menu_manage_tools');
 
 
 -- GRID

+ 1 - 0
modules/boonex/market/classes/BxMarketConfig.php

@@ -136,6 +136,7 @@ class BxMarketConfig extends BxBaseModTextConfig
             'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_market_entry_delete',
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_market_view', // actions menu on view entry page
             'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_market_view_more', 
+            'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_market_view_actions', // all actions menu on view entry page
             'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_market_my', // actions menu on my entries page
             'OBJECT_MENU_ACTIONS_SNIPPET' => 'bx_market_snippet', // actions menu for entry snippet
             'OBJECT_MENU_ACTIONS_SNIPPET_MORE' => 'bx_market_snippet_more', // actions menu (short) from view entry page but created for snippet actions menu

+ 60 - 0
modules/boonex/market/classes/BxMarketMenuViewActions.php

@@ -0,0 +1,60 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    Market Market
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+/**
+ * View entry social actions menu
+ */
+class BxMarketMenuViewActions extends BxBaseModTextMenuViewActions
+{
+    public function __construct($aObject, $oTemplate = false)
+    {
+        $this->_sModule = 'bx_market';
+
+        parent::__construct($aObject, $oTemplate);
+    }
+
+    protected function _getMenuItemDownload($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
+    protected function _getMenuItemAddToCart($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
+    protected function _getMenuItemSubscribe($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
+    protected function _getMenuItemUnhideProduct($aItem)
+    {
+        return $this->_getMenuItemByNameActions($aItem);
+    }
+
+    protected function _getMenuItemHideProduct($aItem)
+    {
+        return $this->_getMenuItemByNameActionsMore($aItem);
+    }
+
+    protected function _getMenuItemEditProduct($aItem)
+    {
+        return $this->_getMenuItemByNameActionsMore($aItem);
+    }
+
+    protected function _getMenuItemDeleteProduct($aItem)
+    {
+        return $this->_getMenuItemByNameActionsMore($aItem);
+    }
+}
+
+/** @} */

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

@@ -13,7 +13,7 @@ DELETE FROM `sys_pages_blocks` WHERE `module` = 'bx_market' OR `object` IN('bx_m
 -- MENU
 DELETE FROM `sys_objects_menu` WHERE `module` = 'bx_market';
 DELETE FROM `sys_menu_sets` WHERE `module` = 'bx_market';
-DELETE FROM `sys_menu_items` WHERE `module` = 'bx_market' OR `set_name` IN('bx_market_view', 'bx_market_view_more', 'bx_market_submenu', 'bx_market_view_submenu', 'bx_market_my', 'bx_market_snippet', 'bx_market_snippet_more', 'bx_market_snippet_meta', 'bx_market_menu_manage_tools', 'bx_market_licenses_submenu');
+DELETE FROM `sys_menu_items` WHERE `module` = 'bx_market' OR `set_name` IN('bx_market_view', 'bx_market_view_more', 'bx_market_view_actions', 'bx_market_submenu', 'bx_market_view_submenu', 'bx_market_my', 'bx_market_snippet', 'bx_market_snippet_more', 'bx_market_snippet_meta', 'bx_market_menu_manage_tools', 'bx_market_licenses_submenu');
 
 -- PRIVACY 
 DELETE FROM `sys_objects_privacy` WHERE `object` IN ('bx_market_allow_view_to', 'bx_market_allow_purchase_to', 'bx_market_allow_comment_to', 'bx_market_allow_vote_to');

+ 29 - 0
modules/boonex/market/install/sql/enable.sql

@@ -267,6 +267,35 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_market_view_more', 'bx_market', 'edit-product', '_bx_market_menu_item_title_system_edit_entry', '_bx_market_menu_item_title_edit_entry', 'page.php?i=edit-product&id={content_id}', '', '', 'pencil-alt', '', 2147483647, 1, 0, 20),
 ('bx_market_view_more', 'bx_market', 'delete-product', '_bx_market_menu_item_title_system_delete_entry', '_bx_market_menu_item_title_delete_entry', 'page.php?i=delete-product&id={content_id}', '', '', 'remove', '', 2147483647, 1, 0, 30);
 
+-- MENU: all actions menu for view entry 
+INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
+('bx_market_view_actions', '_sys_menu_title_view_actions', 'bx_market_view_actions', 'bx_market', 15, 0, 1, 'BxMarketMenuViewActions', 'modules/boonex/market/classes/BxMarketMenuViewActions.php');
+
+INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES 
+('bx_market_view_actions', 'bx_market', '_sys_menu_set_title_view_actions', 0);
+
+INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `submenu_popup`, `visible_for_levels`, `active`, `copyable`, `order`) VALUES 
+('bx_market_view_actions', 'bx_market', 'download', '_bx_market_menu_item_title_system_download', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 1),
+('bx_market_view_actions', 'bx_market', 'add-to-cart', '_bx_market_menu_item_title_system_add_to_cart', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 2),
+('bx_market_view_actions', 'bx_market', 'subscribe', '_bx_market_menu_item_title_system_subscribe', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 3),
+('bx_market_view_actions', 'bx_market', 'unhide-product', '_bx_market_menu_item_title_system_unhide_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 4),
+('bx_market_view_actions', 'bx_market', 'hide-product', '_bx_market_menu_item_title_system_hide_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 5),
+('bx_market_view_actions', 'bx_market', 'edit-product', '_bx_market_menu_item_title_system_edit_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 6),
+('bx_market_view_actions', 'bx_market', 'delete-product', '_bx_market_menu_item_title_system_delete_entry', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 7),
+('bx_market_view_actions', 'bx_market', 'comment', '_sys_menu_item_title_system_va_comment', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 20),
+('bx_market_view_actions', 'bx_market', 'view', '_sys_menu_item_title_system_va_view', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 22),
+('bx_market_view_actions', 'bx_market', 'vote', '_sys_menu_item_title_system_va_vote', '', '', '', '', '', '', '', 0, 2147483647, 0, 0, 22),
+('bx_market_view_actions', 'bx_market', 'score', '_sys_menu_item_title_system_va_score', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 23),
+('bx_market_view_actions', 'bx_market', 'favorite', '_sys_menu_item_title_system_va_favorite', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 24),
+('bx_market_view_actions', 'bx_market', 'feature', '_sys_menu_item_title_system_va_feature', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 25),
+('bx_market_view_actions', 'bx_market', 'repost', '_sys_menu_item_title_system_va_repost', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 26),
+('bx_market_view_actions', 'bx_market', 'report', '_sys_menu_item_title_system_va_report', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 27),
+('bx_market_view_actions', 'bx_market', 'social-sharing-facebook', '_sys_menu_item_title_system_social_sharing_facebook', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 41),
+('bx_market_view_actions', 'bx_market', 'social-sharing-googleplus', '_sys_menu_item_title_system_social_sharing_googleplus', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 42),
+('bx_market_view_actions', 'bx_market', 'social-sharing-twitter', '_sys_menu_item_title_system_social_sharing_twitter', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 43),
+('bx_market_view_actions', 'bx_market', 'social-sharing-pinterest', '_sys_menu_item_title_system_social_sharing_pinterest', '', '', '', '', '', '', '', 0, 2147483647, 1, 0, 44),
+('bx_market_view_actions', 'bx_market', 'more-auto', '_sys_menu_item_title_system_va_more_auto', '_sys_menu_item_title_va_more_auto', 'javascript:void(0)', '', '', 'ellipsis-v', '', '', 0, 2147483647, 1, 0, 9999);
+
 -- MENU: actions menu for my entries
 INSERT INTO `sys_objects_menu`(`object`, `title`, `set_name`, `module`, `template_id`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES 
 ('bx_market_my', '_bx_market_menu_title_entries_my', 'bx_market_my', 'bx_market', 9, 0, 1, 'BxMarketMenu', 'modules/boonex/market/classes/BxMarketMenu.php');