Skip to content

Commit 3330e25

Browse files
committed
Update as of 7/3/2012
* Refactored backend (admin) menu generation: * Menu is separated from `adminhtml.xml` files into `menu.xml` files * Rendering menu became responsibility of `Mage_Backend` instead of `Mage_Adminhtml` module * Implemented XML-Schema for `menu.xml` * Actions with menu items defined in schema: add, remove, move, update, change parent and position * Refactored customers import feature. New ability to provide import data in 3 files: master file (key customer information) + address file (customer id + address info) + financial file (customer id + reward points & store credit) * Optimized memory consumption in integration tests: * Found and eliminated memory leaks in `Mage_Core_Model_App_Area`, `Mage_Core_Model_Layout` * Manually unset objects from PHPUnit test case object in `tearDown()` in integration tests. Garbage collector didn't purge them because of these references * Disabled running `integrity` test suite by default in integration tests * Improvements in visual design editor JavaScript: * eliminated dependency of code on HTML-literals, reduced code coupling between templates and JavaScript files * implemented blocking unwanted JavaScript activity in visual design editor mode * Various fixes in UX, code stability, modularity * GitHub requests: * [#23](#23) -- added `Mage_Customer_Block_Account_Navigation::removeLink()`
1 parent 0c3e67e commit 3330e25

File tree

532 files changed

+16594
-2446
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

532 files changed

+16594
-2446
lines changed

CHANGELOG.markdown

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
Update as of 7/3/2012
2+
=====================
3+
* Refactored backend (admin) menu generation:
4+
* Menu is separated from `adminhtml.xml` files into `menu.xml` files
5+
* Rendering menu became responsibility of `Mage_Backend` instead of `Mage_Adminhtml` module
6+
* Implemented XML-Schema for `menu.xml`
7+
* Actions with menu items defined in schema: add, remove, move, update, change parent and position
8+
* Refactored customers import feature. New ability to provide import data in 3 files: master file (key customer information) + address file (customer id + address info) + financial file (customer id + reward points & store credit)
9+
* Optimized memory consumption in integration tests:
10+
* Found and eliminated memory leaks in `Mage_Core_Model_App_Area`, `Mage_Core_Model_Layout`
11+
* Manually unset objects from PHPUnit test case object in `tearDown()` in integration tests. Garbage collector didn't purge them because of these references
12+
* Disabled running `integrity` test suite by default in integration tests
13+
* Improvements in visual design editor JavaScript:
14+
* eliminated dependency of code on HTML-literals, reduced code coupling between templates and JavaScript files
15+
* implemented blocking unwanted JavaScript activity in visual design editor mode
16+
* Various fixes in UX, code stability, modularity
17+
* GitHub requests:
18+
* [#23](https://github.com/magento/magento2/pull/23) -- added `Mage_Customer_Block_Account_Navigation::removeLink()`
19+
120
Update as of 6/20/2012
221
=====================
322
* Implemented locale translation inheritance
@@ -8,7 +27,7 @@ Update as of 6/20/2012
827
* Implemented optional tracking of changes in view files fallback - cached by default, tracked in developer mode
928
* Introduced `@magentoDbIsolation` annotation in integration tests - isolates DB modifications made by tests
1029
* Started refactoring of Visual Design Editor Javascript architecture
11-
* Github requests:
30+
* GitHub requests:
1231
* [#25](https://github.com/magento/magento2/issues/25) Removed unused `Mage_Core_Block_Abstract::getHelper()` method
1332
* Fixed:
1433
* "$_FILES array is empty" messages in exception log upon installation
@@ -26,8 +45,8 @@ Update as of 6/7/2012
2645
* Eliminated "after commit callback" workaround from integration tests by implementing "transparent transactions" capability in integration testing framework
2746
* Refactored admin authentication/authorization in RSS module. Removed program termination and covered the controllers with tests
2847
* Removed HTML-report feature of copy-paste detector which never worked anyway (`dev/tests/static/framework/Inspection/CopyPasteDetector/html_report.xslt` and all related code)
29-
* Github requests:
30-
** [#19](https://github.com/magento/magento2/pull/19) Implemented "soft" dependency between modules and performed several improvements in the related code, covered with tests
48+
* GitHub requests:
49+
* [#19](https://github.com/magento/magento2/pull/19) Implemented "soft" dependency between modules and performed several improvements in the related code, covered with tests
3150

3251
Update as of 5/31/2012
3352
======================

app/code/core/Mage/Admin/Model/Config.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -333,20 +333,4 @@ public function getAdminhtmlConfig()
333333
{
334334
return $this->_adminhtmlConfig;
335335
}
336-
337-
/**
338-
* Get menu item label by item path
339-
*
340-
* @param string $path
341-
* @return string
342-
*/
343-
public function getMenuItemLabel($path)
344-
{
345-
$moduleName = 'Mage_Adminhtml_Helper_Data';
346-
$menuNode = $this->getAdminhtmlConfig()->getNode('menu/' . str_replace('/', '/children/', trim($path, '/')));
347-
if ($menuNode->getAttribute('module')) {
348-
$moduleName = (string)$menuNode->getAttribute('module');
349-
}
350-
return $this->_getHelper($moduleName)->__((string)$menuNode->title);
351-
}
352336
}

app/code/core/Mage/AdminNotification/etc/adminhtml.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,4 @@
6060
</admin>
6161
</resources>
6262
</acl>
63-
<menu>
64-
<system>
65-
<children>
66-
<adminnotification translate="title" module="Mage_AdminNotification">
67-
<title>Notifications</title>
68-
<action>adminhtml/notification</action>
69-
<sort_order>15</sort_order>
70-
</adminnotification>
71-
</children>
72-
</system>
73-
</menu>
7463
</config>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Magento
5+
*
6+
* NOTICE OF LICENSE
7+
*
8+
* This source file is subject to the Academic Free License (AFL 3.0)
9+
* that is bundled with this package in the file LICENSE_AFL.txt.
10+
* It is also available through the world-wide-web at this URL:
11+
* http://opensource.org/licenses/afl-3.0.php
12+
* If you did not receive a copy of the license and are unable to
13+
* obtain it through the world-wide-web, please send an email
14+
* to license@magentocommerce.com so we can send you a copy immediately.
15+
*
16+
* DISCLAIMER
17+
*
18+
* Do not edit or add to this file if you wish to upgrade Magento to newer
19+
* versions in the future. If you wish to customize Magento for your
20+
* needs please refer to http://www.magentocommerce.com for more information.
21+
*
22+
* @category Mage
23+
* @package Mage_AdminNotification
24+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
25+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26+
*/
27+
-->
28+
<config>
29+
<menu>
30+
<add id="Mage_AdminNotification::system_adminnotification" title="Notifications" module="Mage_AdminNotification" sortOrder="15" parent="Mage_Adminhtml::system" action="adminhtml/notification" />
31+
</menu>
32+
</config>

app/code/core/Mage/Adminhtml/Block/Report/Product/Viewed/Grid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Mage_Adminhtml_Block_Report_Product_Viewed_Grid extends Mage_Adminhtml_Blo
4545
*
4646
* @var string
4747
*/
48-
protected $_resourceCollectionName = 'Mage_Reports_Model_Resource_Product_Viewed_Collection';
48+
protected $_resourceCollectionName = 'Mage_Reports_Model_Resource_Report_Product_Viewed_Collection';
4949

5050
/**
5151
* Init grid parameters

app/code/core/Mage/Adminhtml/Block/System/Email/Template/Edit.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,16 @@ protected function _getSystemConfigPathsParts($paths)
350350
$result = $urlParams = $prefixParts = array();
351351
$scopeLabel = Mage::helper('Mage_Adminhtml_Helper_Data')->__('GLOBAL');
352352
if ($paths) {
353+
/** @var $menu Mage_Backend_Model_Menu */
354+
$menu = Mage::getSingleton('Mage_Backend_Model_Menu_Config')->getMenu();
355+
$item = $menu->get('Mage_Adminhtml::system');
353356
// create prefix path parts
354357
$prefixParts[] = array(
355-
'title' => Mage::getSingleton('Mage_Admin_Model_Config')->getMenuItemLabel('system'),
358+
'title' => $item->getModuleHelper()->__($item->getTitle()),
356359
);
360+
$item = $menu->get('Mage_Adminhtml::system_config');
357361
$prefixParts[] = array(
358-
'title' => Mage::getSingleton('Mage_Admin_Model_Config')->getMenuItemLabel('system/config'),
362+
'title' => $item->getModuleHelper()->__($item->getTitle()),
359363
'url' => $this->getUrl('adminhtml/system_config/'),
360364
);
361365

app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function _construct()
4848
protected function _initAction()
4949
{
5050
$this->loadLayout()
51-
->_setActiveMenu('sales/order')
51+
->_setActiveMenu('Mage_Sales::sales_order')
5252
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
5353
->_addBreadcrumb($this->__('Credit Memos'),$this->__('Credit Memos'));
5454
return $this;

app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function _construct()
4848
protected function _initAction()
4949
{
5050
$this->loadLayout()
51-
->_setActiveMenu('sales/order')
51+
->_setActiveMenu('Mage_Sales::sales_order')
5252
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
5353
->_addBreadcrumb($this->__('Invoices'),$this->__('Invoices'));
5454
return $this;

app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function _construct()
4848
protected function _initAction()
4949
{
5050
$this->loadLayout()
51-
->_setActiveMenu('sales/order')
51+
->_setActiveMenu('Mage_Sales::sales_order')
5252
->_addBreadcrumb($this->__('Sales'), $this->__('Sales'))
5353
->_addBreadcrumb($this->__('Shipments'),$this->__('Shipments'));
5454
return $this;

app/code/core/Mage/Adminhtml/Model/System/Config/Source/Admin/Page.php

Lines changed: 56 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -34,136 +34,87 @@
3434
*/
3535
class Mage_Adminhtml_Model_System_Config_Source_Admin_Page
3636
{
37-
protected $_url;
37+
/**
38+
* Menu model
39+
*
40+
* @var Mage_Backend_Model_Menu
41+
*/
42+
protected $_menu;
43+
44+
/**
45+
* Object factory
46+
*
47+
* @var Mage_Core_Model_Config
48+
*/
49+
protected $_objectFactory;
50+
51+
/**
52+
* Default construct
53+
*/
54+
public function __construct(array $data = array())
55+
{
56+
$this->_menu = isset($data['menu']) ?
57+
$data['menu'] :
58+
Mage::getSingleton('Mage_Backend_Model_Menu_Config')->getMenu();
59+
60+
$this->_objectFactory = isset($data['objectFactory']) ? $data['objectFactory'] : Mage::getConfig();
61+
}
3862

3963
public function toOptionArray()
4064
{
4165
$options = array();
42-
$menu = $this->_buildMenuArray();
43-
44-
$this->_createOptions($options, $menu);
45-
66+
$this->_createOptions($options, $this->_menu);
4667
return $options;
4768
}
4869

49-
protected function _createOptions(&$optionArray, $menuNode)
70+
/**
71+
* Get menu filter iterator
72+
*
73+
* @param Mage_Backend_Model_Menu $menu menu model
74+
* @return Mage_Backend_Model_Menu_Filter_Iterator
75+
*/
76+
protected function _getMenuIterator(Mage_Backend_Model_Menu $menu)
77+
{
78+
return $this->_objectFactory->getModelInstance('Mage_Backend_Model_Menu_Filter_Iterator', $menu->getIterator());
79+
}
80+
81+
/**
82+
* Create options array
83+
*
84+
* @param array $optionArray
85+
* @param Mage_Backend_Model_Menu $menu
86+
* @param int $level
87+
*/
88+
protected function _createOptions(&$optionArray, Mage_Backend_Model_Menu $menu, $level = 0)
5089
{
5190
$nonEscapableNbspChar = html_entity_decode('&#160;', ENT_NOQUOTES, 'UTF-8');
91+
$paddingString = str_repeat($nonEscapableNbspChar, ($level * 4));
5292

53-
foreach ($menuNode as $menu) {
93+
foreach ($this->_getMenuIterator($menu) as $menuItem) {
5494

55-
if (!empty($menu['url'])) {
95+
/**@var $menuItem Mage_Backend_Model_Menu_Item */
96+
if ($menuItem->getAction()) {
5697
$optionArray[] = array(
57-
'label' => str_repeat($nonEscapableNbspChar, ($menu['level'] * 4)) . $menu['label'],
58-
'value' => $menu['path'],
98+
'label' => $paddingString . $menuItem->getTitle(),
99+
'value' => $menuItem->getId(),
59100
);
60101

61-
if (isset($menu['children'])) {
62-
$this->_createOptions($optionArray, $menu['children']);
102+
if ($menuItem->hasChildren()) {
103+
$this->_createOptions($optionArray, $menuItem->getChildren(), $level + 1);
63104
}
64105
}
65106
else {
66107
$children = array();
67108

68-
if(isset($menu['children'])) {
69-
$this->_createOptions($children, $menu['children']);
109+
if($menuItem->hasChildren()) {
110+
$this->_createOptions($children, $menuItem->getChildren(), $level + 1);
70111
}
71112

72113
$optionArray[] = array(
73-
'label' => str_repeat($nonEscapableNbspChar, ($menu['level'] * 4)) . $menu['label'],
114+
'label' => $paddingString . $menuItem->getTitle(),
74115
'value' => $children,
75116
);
76117
}
77118
}
78119
}
79-
80-
protected function _getUrlModel()
81-
{
82-
if (is_null($this->_url)) {
83-
$this->_url = Mage::getModel('Mage_Adminhtml_Model_Url');
84-
}
85-
return $this->_url;
86-
}
87-
88-
protected function _buildMenuArray(Varien_Simplexml_Element $parent=null, $path='', $level=0)
89-
{
90-
if (is_null($parent)) {
91-
$parent = Mage::getSingleton('Mage_Admin_Model_Config')->getAdminhtmlConfig()->getNode('menu');
92-
}
93-
94-
$parentArr = array();
95-
$sortOrder = 0;
96-
foreach ($parent->children() as $childName=>$child) {
97-
if ((1 == $child->disabled)
98-
|| ($child->depends && !$this->_checkDepends($child->depends))
99-
) {
100-
continue;
101-
}
102-
103-
$menuArr = array();
104-
$menuArr['label'] = $this->_getHelperValue($child);
105-
106-
$menuArr['sort_order'] = $child->sort_order ? (int)$child->sort_order : $sortOrder;
107-
108-
if ($child->action) {
109-
$menuArr['url'] = (string)$child->action;
110-
} else {
111-
$menuArr['url'] = '';
112-
}
113-
114-
$menuArr['level'] = $level;
115-
$menuArr['path'] = $path . $childName;
116-
117-
if ($child->children) {
118-
$menuArr['children'] = $this->_buildMenuArray($child->children, $path.$childName.'/', $level+1);
119-
}
120-
$parentArr[$childName] = $menuArr;
121-
122-
$sortOrder++;
123-
}
124-
125-
uasort($parentArr, array($this, '_sortMenu'));
126-
127-
while (list($key, $value) = each($parentArr)) {
128-
$last = $key;
129-
}
130-
if (isset($last)) {
131-
$parentArr[$last]['last'] = true;
132-
}
133-
134-
return $parentArr;
135-
}
136-
137-
protected function _sortMenu($a, $b)
138-
{
139-
return $a['sort_order']<$b['sort_order'] ? -1 : ($a['sort_order']>$b['sort_order'] ? 1 : 0);
140-
}
141-
142-
protected function _checkDepends(Varien_Simplexml_Element $depends)
143-
{
144-
if ($depends->module) {
145-
$modulesConfig = Mage::getConfig()->getNode('modules');
146-
foreach ($depends->module as $module) {
147-
if (!$modulesConfig->$module || !$modulesConfig->$module->is('active')) {
148-
return false;
149-
}
150-
}
151-
}
152-
153-
return true;
154-
}
155-
156-
protected function _getHelperValue(Varien_Simplexml_Element $child)
157-
{
158-
$helperName = 'Mage_Adminhtml_Helper_Data';
159-
$titleNodeName = 'title';
160-
$childAttributes = $child->attributes();
161-
if (isset($childAttributes['module'])) {
162-
$helperName = (string)$childAttributes['module'];
163-
}
164-
165-
$titleNodeName = 'title';
166-
167-
return Mage::helper($helperName)->__((string)$child->$titleNodeName);
168-
}
169120
}

app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Mage_Adminhtml_Api_RoleController extends Mage_Adminhtml_Controller_Action
3737
protected function _initAction()
3838
{
3939
$this->loadLayout();
40-
$this->_setActiveMenu('system/services/roles');
40+
$this->_setActiveMenu('Mage_Api::system_api_roles');
4141
$this->_addBreadcrumb($this->__('Web services'), $this->__('Web services'));
4242
$this->_addBreadcrumb($this->__('Permissions'), $this->__('Permissions'));
4343
$this->_addBreadcrumb($this->__('Roles'), $this->__('Roles'));

app/code/core/Mage/Adminhtml/controllers/Api/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Mage_Adminhtml_Api_UserController extends Mage_Adminhtml_Controller_Action
2929
protected function _initAction()
3030
{
3131
$this->loadLayout()
32-
->_setActiveMenu('system/services/users')
32+
->_setActiveMenu('Mage_Api::system_api_users')
3333
->_addBreadcrumb($this->__('Web Services'), $this->__('Web Services'))
3434
->_addBreadcrumb($this->__('Permissions'), $this->__('Permissions'))
3535
->_addBreadcrumb($this->__('Users'), $this->__('Users'))

app/code/core/Mage/Adminhtml/controllers/CacheController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function indexAction()
4444
$this->_title($this->__('System'))->_title($this->__('Cache Management'));
4545

4646
$this->loadLayout()
47-
->_setActiveMenu('system/cache')
47+
->_setActiveMenu('Mage_Adminhtml::system_cache')
4848
->renderLayout();
4949
}
5050

app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function editAction()
199199
}
200200

201201
$this->loadLayout();
202-
$this->_setActiveMenu('catalog/categories');
202+
$this->_setActiveMenu('Mage_Catalog::catalog_categories');
203203
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true)
204204
->setContainerCssClass('catalog-categories');
205205

0 commit comments

Comments
 (0)