Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update as of 8/26/2012

* Decoupled Tag module functionality from other modules
* Visual Design Editor:
  * Implemented tracking of user changes history and rendering the actions at VDE toolbar
  * Implemented compacting of user changes history. Compacting is done in order to save all the changes as a minimal layout update.
* Improvements:
  * Added Atlassian IDE Plugin configuration files to `.gitignore`
  * Relocated `add_to_cart`, `checkout` and `product_edit` performance scenarios from `samples` to the normal `testsuite` directory. These scenarios can be used for Magento performance testing.
  * Implemented verification of number of orders that were created during execution of `checkout` performance scenario
  * Removed usage of deprecated `PHPUnit_Extensions_OutputTestCase` class from unit tests
* Fixes:
  * Fixed MySQL DB adapter to always throw exception, if it was not able to connect to DB because of wrong configuration. So now the adapter's behavior is not dependent on `error_reporting` settings.
  * Added the missing closing tag to New Order email template
  * Fixed `Mage_ImportExport_Model_Import_Entity_CustomerComposite` integration test issues
  * Marked several integration tests in `Mage_Adminhtml_CustomerControllerTest` as incomplete, as the tested functionality was not MMDB-compliant
  * Fixed issue with unit tests failure, when there was a Zend Framework installed as PEAR package
  * Fixed `advanced_search` performance scenario to fail, if the searched product doesn't exist
  * Fixed issue with non-escaped latest message link in admin backend
* GitHub requests:
  * [#48](#48) -- fixed usage of a collection at the place, where just a single object was needed
  • Loading branch information...
commit f1494386a6e21928ecc688b9bfe91112ff8f6fab 1 parent 37bf8f2
@mage2-team mage2-team authored
Showing with 6,147 additions and 1,890 deletions.
  1. +1 −0  .gitignore
  2. +22 −0 CHANGELOG.markdown
  3. +0 −16 app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php
  4. +0 −122 app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tags.php
  5. +0 −8 app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php
  6. +0 −23 app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
  7. +200 −369 app/code/core/Mage/Adminhtml/controllers/CustomerController.php
  8. +2 −5 app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
  9. +0 −3  app/code/core/Mage/Adminhtml/etc/config.xml
  10. +0 −12 app/code/core/Mage/Adminhtml/view/adminhtml/catalog.xml
  11. +0 −12 app/code/core/Mage/Adminhtml/view/adminhtml/customer.xml
  12. +1 −1  app/code/core/Mage/Adminhtml/view/adminhtml/notification/toolbar.phtml
  13. +50 −6 app/code/core/Mage/Catalog/Helper/Product/View.php
  14. +10 −0 app/code/core/Mage/Catalog/etc/config.xml
  15. +1 −3 app/code/core/Mage/CatalogSearch/view/frontend/result.phtml
  16. +2 −1  app/code/core/Mage/Core/Helper/Js.php
  17. +23 −0 app/code/core/Mage/DesignEditor/Block/Template.php
  18. +14 −1 app/code/core/Mage/DesignEditor/Block/Toolbar.php
  19. +61 −0 app/code/core/Mage/DesignEditor/Block/Toolbar/Buttons.php
  20. +5 −5 app/code/core/Mage/DesignEditor/Block/Toolbar/{Exit.php → History.php}
  21. +43 −0 app/code/core/Mage/DesignEditor/Block/Wrapper/Remove.php
  22. +143 −0 app/code/core/Mage/DesignEditor/Model/History.php
  23. +83 −0 app/code/core/Mage/DesignEditor/Model/History/Manager.php
  24. +58 −0 app/code/core/Mage/DesignEditor/Model/History/Manager/Adapter.php
  25. +76 −0 app/code/core/Mage/DesignEditor/Model/History/Manager/Adapter/Abstract.php
  26. +187 −0 app/code/core/Mage/DesignEditor/Model/History/Manager/Adapter/Layout.php
  27. +166 −0 app/code/core/Mage/DesignEditor/Model/History/Manager/Collection.php
  28. +12 −7 app/code/core/Mage/DesignEditor/Model/Observer.php
  29. +57 −1 app/code/core/Mage/DesignEditor/controllers/EditorController.php
  30. +38 −0 app/code/core/Mage/DesignEditor/etc/jstranslator.xml
  31. +42 −4 app/code/core/Mage/DesignEditor/view/frontend/css/styles.css
  32. +136 −136 app/code/core/Mage/DesignEditor/view/frontend/js/base.js
  33. +67 −0 app/code/core/Mage/DesignEditor/view/frontend/js/change/history.js
  34. +333 −0 app/code/core/Mage/DesignEditor/view/frontend/js/change/layout.js
  35. +536 −181 app/code/core/Mage/DesignEditor/view/frontend/js/design_editor.js
  36. +3 −1 app/code/core/Mage/DesignEditor/view/frontend/layout.xml
  37. +26 −24 app/code/core/Mage/DesignEditor/view/frontend/toolbar.phtml
  38. +39 −0 app/code/core/Mage/DesignEditor/view/frontend/toolbar/buttons.phtml
  39. +4 −4 app/code/core/Mage/DesignEditor/view/frontend/toolbar/{exit.phtml → history.phtml}
  40. +32 −0 app/code/core/Mage/DesignEditor/view/frontend/wrapper/remove.phtml
  41. +6 −3 app/code/core/Mage/DesignEditor/view/frontend/wrapping.phtml
  42. +0 −15 app/code/core/Mage/ImportExport/Model/Import/Entity/Product/Type/Abstract.php
  43. +0 −1  app/code/core/Mage/Page/etc/config.xml
  44. +0 −5 app/code/core/Mage/Reports/etc/adminhtml/acl.xml
  45. +0 −47 app/code/core/Mage/Rss/Helper/Catalog.php
  46. +0 −17 app/code/core/Mage/Rss/controllers/CatalogController.php
  47. +0 −9 app/code/core/Mage/Rss/etc/system.xml
  48. +0 −6 app/code/core/Mage/Rss/view/frontend/layout.xml
  49. +1 −0  app/code/core/Mage/Sales/view/email/order_new.html
  50. +14 −14 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Assigned/Grid.php
  51. +164 −0 app/code/core/Mage/Tag/Block/Adminhtml/Catalog/Product/Edit/Tab/Tag.php
  52. +164 −0 app/code/core/Mage/Tag/Block/Adminhtml/Catalog/Product/Edit/Tab/Tag/Customer.php
  53. +24 −23 ...roduct/Edit/Tab/Tag/Customer.php → Tag/Block/Adminhtml/Catalog/Product/Edit/Tab/Tag/Customer/Grid.php}
  54. +11 −11 ...ml/Block/Catalog/Product/Edit/Tab/Tag.php → Tag/Block/Adminhtml/Catalog/Product/Edit/Tab/Tag/Grid.php}
  55. +4 −4 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Customer.php
  56. +163 −0 app/code/core/Mage/Tag/Block/Adminhtml/Customer/Edit/Tab/Tag.php
  57. +65 −32 .../Mage/{Adminhtml/Block/Customer/Edit/Tab/Tag.php → Tag/Block/Adminhtml/Customer/Edit/Tab/Tag/Grid.php}
  58. +5 −5 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Customer/Grid.php
  59. +10 −9 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Edit.php
  60. +3 −3 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Edit/Accordion.php
  61. +3 −3 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Edit/Assigned.php
  62. +6 −6 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Edit/Form.php
  63. +4 −4 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Grid/All.php
  64. +3 −3 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Grid/Pending.php
  65. +4 −4 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Pending.php
  66. +4 −4 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Product.php
  67. +6 −6 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Product/Grid.php
  68. +7 −7 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Customer.php
  69. +7 −8 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Customer/Detail.php
  70. +11 −12 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Customer/Detail/Grid.php
  71. +13 −14 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Customer/Grid.php
  72. +7 −7 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Popular.php
  73. +7 −9 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Popular/Detail.php
  74. +14 −15 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Popular/Detail/Grid.php
  75. +11 −13 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Popular/Grid.php
  76. +7 −7 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Product.php
  77. +7 −7 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Product/Detail.php
  78. +11 −12 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Product/Detail/Grid.php
  79. +14 −15 app/code/core/Mage/{Adminhtml/Block/Report/Tag → Tag/Block/Adminhtml/Report}/Product/Grid.php
  80. +3 −3 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Store/Switcher.php
  81. +6 −5 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Tag.php
  82. +3 −3 app/code/core/Mage/{Adminhtml/Block/Tag → Tag/Block/Adminhtml}/Tag/Grid.php
  83. +9 −8 app/code/core/Mage/{Rss/Block/Catalog/Tag.php → Tag/Block/Catalog/Product/Rss.php}
  84. +114 −0 app/code/core/Mage/Tag/Block/Catalog/Product/Rss/Link.php
  85. +5 −6 app/code/core/Mage/{Reports/Model/Resource/Tag → Tag/Model/Resource/Reports}/Collection.php
  86. +4 −5 app/code/core/Mage/{Reports/Model/Resource/Tag → Tag/Model/Resource/Reports}/Customer/Collection.php
  87. +12 −13 app/code/core/Mage/{Reports/Model/Resource/Tag → Tag/Model/Resource/Reports}/Product/Collection.php
  88. +58 −0 app/code/core/Mage/Tag/controllers/Adminhtml/Catalog/ProductController.php
  89. +91 −0 app/code/core/Mage/Tag/controllers/Adminhtml/CustomerController.php
  90. +79 −44 app/code/core/Mage/{Adminhtml/controllers → Tag/controllers/Adminhtml}/Report/TagController.php
  91. +44 −18 app/code/core/Mage/{Adminhtml/controllers → Tag/controllers/Adminhtml}/TagController.php
  92. +19 −17 app/code/core/Mage/Tag/controllers/IndexController.php
  93. +60 −0 app/code/core/Mage/Tag/controllers/Rss/CatalogController.php
  94. +7 −0 app/code/core/Mage/Tag/etc/adminhtml/acl.xml
  95. +46 −0 app/code/core/Mage/Tag/etc/config.xml
  96. +48 −0 app/code/core/Mage/Tag/etc/system.xml
  97. +49 −0 app/code/core/Mage/Tag/view/adminhtml/customer.xml
  98. +50 −0 app/code/core/Mage/Tag/view/adminhtml/product.xml
  99. +9 −9 app/code/core/Mage/{Adminhtml → Tag}/view/adminhtml/tag.xml
  100. 0  app/code/core/Mage/{Adminhtml → Tag}/view/adminhtml/tag/edit/container.phtml
  101. 0  app/code/core/Mage/{Adminhtml → Tag}/view/adminhtml/tag/index.phtml
  102. +1 −0  app/code/core/Mage/Tag/view/frontend/layout.xml
  103. +30 −0 app/code/core/Mage/Tag/view/frontend/product/rss/link.phtml
  104. +38 −0 app/code/core/Mage/Tag/view/frontend/rss.xml
  105. +0 −1  app/design/frontend/default/iphone/Mage_Catalog/product/view.phtml
  106. +1 −3 app/design/frontend/default/iphone/Mage_CatalogSearch/result.phtml
  107. +0 −6 app/design/frontend/default/iphone/Mage_Rss/layout.xml
  108. +1 −0  app/design/frontend/default/iphone/Mage_Tag/layout.xml
  109. +0 −4 app/design/frontend/default/modern/Mage_Rss/layout.xml
  110. +1 −0  app/design/frontend/default/modern/Mage_Tag/layout.xml
  111. +2 −8 dev/tests/integration/testsuite/Mage/Adminhtml/controllers/CustomerControllerTest.php
  112. +7 −0 dev/tests/integration/testsuite/Mage/Adminhtml/controllers/Sales/OrderControllerTest.php
  113. +2 −2 dev/tests/integration/testsuite/Mage/Catalog/Helper/Product/CompareTest.php
  114. +43 −2 dev/tests/integration/testsuite/Mage/Catalog/Helper/Product/ViewTest.php
  115. +3 −3 dev/tests/integration/testsuite/Mage/Catalog/Model/Product/Type/AbstractTest.php
  116. +1 −1  dev/tests/integration/testsuite/Mage/Catalog/Model/ProductTest.php
  117. +49 −7 dev/tests/integration/testsuite/Mage/Catalog/_files/{two_products.php → multiple_products.php}
  118. +2 −2 dev/tests/integration/testsuite/Mage/DesignEditor/Block/Toolbar/ExitTest.php
  119. +178 −0 dev/tests/integration/testsuite/Mage/DesignEditor/Model/HistoryTest.php
  120. +36 −8 dev/tests/integration/testsuite/Mage/DesignEditor/Model/ObserverTest.php
  121. +36 −0 dev/tests/integration/testsuite/Mage/DesignEditor/_files/history/compact_log.xml
  122. +0 −196 dev/tests/integration/testsuite/Mage/ImportExport/Model/Import/Entity/CustomerCompositeTest.php
  123. +114 −0 dev/tests/integration/testsuite/Mage/ImportExport/Model/Import/Entity/Product/Type/AbstractTest.php
  124. +79 −0 dev/tests/integration/testsuite/Mage/ImportExport/Model/Import/Entity/ProductTest.php
  125. +0 −2  dev/tests/integration/testsuite/Mage/ImportExport/Model/Import/Entity/_files/customer_composite_delete.csv
  126. +0 −7 dev/tests/integration/testsuite/Mage/ImportExport/Model/Import/Entity/_files/customer_composite_update.csv
  127. +4 −0 dev/tests/integration/testsuite/Mage/ImportExport/Model/Import/Entity/_files/products_to_import.csv
  128. +0 −1  dev/tests/integration/testsuite/Mage/Page/_files/robots.txt
  129. +1 −1  dev/tests/integration/testsuite/Mage/Review/_files/reviews.php
  130. +3 −2 dev/tests/integration/testsuite/Mage/Rss/controllers/CatalogControllerTest.php
  131. +30 −0 dev/tests/js/testsuite/mage/design_editor/historyTest.js
  132. +31 −0 dev/tests/js/testsuite/mage/design_editor/historyToolbarTest.js
  133. +230 −186 dev/tests/js/testsuite/mage/design_editor/pageTest.js
  134. +42 −0 dev/tests/performance/framework/Magento/Scenario.php
  135. +4 −0 dev/tests/performance/framework/tests/unit/testsuite/Magento/ConfigTest.php
  136. +27 −0 dev/tests/performance/framework/tests/unit/testsuite/Magento/ScenarioTest.php
  137. +29 −0 dev/tests/performance/framework/tests/unit/testsuite/Magento/_files/scenario_with_scripts.jmx
  138. +37 −0 dev/tests/performance/framework/tests/unit/testsuite/Magento/_files/scenario_with_scripts.jtl
  139. +28 −0 dev/tests/performance/framework/tests/unit/testsuite/Magento/_files/scenario_with_scripts_after.php
  140. +28 −0 dev/tests/performance/framework/tests/unit/testsuite/Magento/_files/scenario_with_scripts_before.php
  141. 0  dev/tests/performance/testsuite/{_samples → }/add_to_cart.jmx
  142. +13 −6 dev/tests/performance/testsuite/advanced_search.jmx
  143. 0  dev/tests/performance/testsuite/{_samples → }/checkout.jmx
  144. +49 −0 dev/tests/performance/testsuite/checkout_after.php
  145. +33 −0 dev/tests/performance/testsuite/checkout_before.php
  146. 0  dev/tests/performance/testsuite/{_samples → }/product_edit.jmx
  147. +2 −1  dev/tests/static/testsuite/Legacy/_files/obsolete_methods.php
  148. +2 −0  dev/tests/static/testsuite/Php/_files/whitelist/core.txt
  149. +4 −4 dev/tests/unit/framework/bootstrap.php
  150. +226 −0 dev/tests/unit/testsuite/Mage/DesignEditor/Model/HistoryTest.php
  151. +105 −0 dev/tests/unit/testsuite/Mage/DesignEditor/Model/Manager/Adapter/LayoutTest.php
  152. +31 −0 dev/tests/unit/testsuite/Mage/DesignEditor/Model/_files/history/layout/move.xml
  153. +31 −0 dev/tests/unit/testsuite/Mage/DesignEditor/Model/_files/history/layout/remove.xml
  154. +55 −0 dev/tests/unit/testsuite/Mage/Tag/Block/Adminhtml/Catalog/Product/Edit/Tab/Tag/CustomerTest.php
  155. +56 −0 dev/tests/unit/testsuite/Mage/Tag/Block/Adminhtml/Catalog/Product/Edit/Tab/TagTest.php
  156. +135 −0 dev/tests/unit/testsuite/Mage/Tag/Block/Adminhtml/Catalog/Product/Edit/Tab/TagTestCaseAbstract.php
  157. +192 −0 dev/tests/unit/testsuite/Mage/Tag/Block/Adminhtml/Customer/Edit/Tab/TagTest.php
  158. +121 −0 dev/tests/unit/testsuite/Mage/Tag/Block/Catalog/Product/Rss/LinkTest.php
  159. +1 −1  dev/tests/unit/testsuite/tools/migration/Acl/Db/Logger/ConsoleTest.php
  160. +4 −0 lib/Varien/Db/Adapter/Pdo/Mysql.php
View
1  .gitignore
@@ -4,6 +4,7 @@
/.metadata
/.project
/.settings
+atlassian*
/index.php
/nbproject
/sitemap
View
22 CHANGELOG.markdown
@@ -1,3 +1,25 @@
+Update as of 8/26/2012
+======================
+* Decoupled Tag module functionality from other modules
+* Visual Design Editor:
+ * Implemented tracking of user changes history and rendering the actions at VDE toolbar
+ * Implemented compacting of user changes history. Compacting is done in order to save all the changes as a minimal layout update.
+* Improvements:
+ * Added Atlassian IDE Plugin configuration files to `.gitignore`
+ * Relocated `add_to_cart`, `checkout` and `product_edit` performance scenarios from `samples` to the normal `testsuite` directory. These scenarios can be used for Magento performance testing.
+ * Implemented verification of number of orders that were created during execution of `checkout` performance scenario
+ * Removed usage of deprecated `PHPUnit_Extensions_OutputTestCase` class from unit tests
+* Fixes:
+ * Fixed MySQL DB adapter to always throw exception, if it was not able to connect to DB because of wrong configuration. So now the adapter's behavior is not dependent on `error_reporting` settings.
+ * Added the missing closing tag to New Order email template
+ * Fixed `Mage_ImportExport_Model_Import_Entity_CustomerComposite` integration test issues
+ * Marked several integration tests in `Mage_Adminhtml_CustomerControllerTest` as incomplete, as the tested functionality was not MMDB-compliant
+ * Fixed issue with unit tests failure, when there was a Zend Framework installed as PEAR package
+ * Fixed `advanced_search` performance scenario to fail, if the searched product doesn't exist
+ * Fixed issue with non-escaped latest message link in admin backend
+* GitHub requests:
+ * [#48](https://github.com/magento/magento2/pull/48) -- fixed usage of a collection at the place, where just a single object was needed
+
Update as of 8/15/2012
======================
* Refactored ACL functionality:
View
16 app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php
@@ -154,22 +154,6 @@ protected function _prepareLayout()
));
}
}
- if (Mage::helper('Mage_Catalog_Helper_Data')->isModuleEnabled('Mage_Tag')) {
- if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Tag::tag')){
- $this->addTab('tags', array(
- 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Product Tags'),
- 'url' => $this->getUrl('*/*/tagGrid', array('_current' => true)),
- 'class' => 'ajax',
- ));
-
- $this->addTab('customers_tags', array(
- 'label' => Mage::helper('Mage_Catalog_Helper_Data')->__('Customers Tagged Product'),
- 'url' => $this->getUrl('*/*/tagCustomerGrid', array('_current' => true)),
- 'class' => 'ajax',
- ));
- }
- }
-
}
/**
View
122 app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Tags.php
@@ -1,122 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
-
-/**
- * Adminhtml customer orders grid block
- *
- * @category Mage
- * @package Mage_Adminhtml
- * @author Magento Core Team <core@magentocommerce.com>
- */
-class Mage_Adminhtml_Block_Customer_Edit_Tab_Tags extends Mage_Adminhtml_Block_Widget_Grid
-{
-
- public function __construct()
- {
- parent::__construct();
- $this->setId('ordersGrid');
- $this->setUseAjax(true);
- }
-
- protected function _prepareCollection()
- {
- $collection = Mage::getResourceModel('Mage_Customer_Model_Resource_Customer_Collection')
- ->addNameToSelect()
- ->addAttributeToSelect('email')
- ->addAttributeToSelect('created_at')
- ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing')
- ->joinAttribute('billing_city', 'customer_address/city', 'default_billing')
- ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing')
- ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing');
-
- $this->setCollection($collection);
-
- return parent::_prepareCollection();
- }
-
- protected function _prepareColumns()
- {
- $this->addColumn('entity_id', array(
- 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('ID'),
- 'width' =>5,
- 'align' =>'center',
- 'sortable' =>true,
- 'index' =>'entity_id'
- ));
- $this->addColumn('name', array(
- 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('Name'),
- 'index' =>'name'
- ));
- $this->addColumn('email', array(
- 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('Email'),
- 'width' =>40,
- 'align' =>'center',
- 'index' =>'email'
- ));
- $this->addColumn('telephone', array(
- 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('Telephone'),
- 'align' =>'center',
- 'index' =>'billing_telephone'
- ));
- $this->addColumn('billing_postcode', array(
- 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('ZIP/Post Code'),
- 'index' =>'billing_postcode',
- ));
- $this->addColumn('billing_country_id', array(
- 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('Country'),
- 'type' => 'country',
- 'index' => 'billing_country_id',
- ));
- $this->addColumn('customer_since', array(
- 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('Customer Since'),
- 'type' => 'date',
- 'format' => 'Y.m.d',
- 'index' =>'created_at',
- ));
- $this->addColumn('action', array(
- 'header' => Mage::helper('Mage_Customer_Helper_Data')->__('Action'),
- 'align' =>'center',
- 'format' =>'<a href="'.$this->getUrl('*/sales/edit/id/$entity_id').'">'.Mage::helper('Mage_Customer_Helper_Data')->__('Edit').'</a>',
- 'filter' =>false,
- 'sortable' =>false,
- 'is_system' =>true
- ));
-
- $this->setColumnFilter('entity_id')
- ->setColumnFilter('email')
- ->setColumnFilter('name');
-
- $this->addExportType('*/*/exportCsv', Mage::helper('Mage_Customer_Helper_Data')->__('CSV'));
- $this->addExportType('*/*/exportXml', Mage::helper('Mage_Customer_Helper_Data')->__('Excel XML'));
- return parent::_prepareColumns();
- }
-
- public function getGridUrl()
- {
- return $this->getUrl('*/*/index', array('_current'=>true));
- }
-
-}
View
8 app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php
@@ -108,14 +108,6 @@ protected function _beforeToHtml()
'url' => $this->getUrl('*/*/productReviews', array('_current' => true)),
));
}
-
- if (Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Tag::tag')) {
- $this->addTab('tags', array(
- 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Product Tags'),
- 'class' => 'ajax',
- 'url' => $this->getUrl('*/*/productTags', array('_current' => true)),
- ));
- }
}
$this->_updateActiveTab();
View
23 app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
@@ -810,17 +810,6 @@ public function deleteAction()
}
/**
- * Get tag grid
- */
- public function tagGridAction()
- {
- $this->loadLayout();
- $this->getLayout()->getBlock('admin.product.tags')
- ->setProductId($this->getRequest()->getParam('id'));
- $this->renderLayout();
- }
-
- /**
* Get alerts price grid
*/
public function alertsPriceGridAction()
@@ -936,18 +925,6 @@ public function _validateMassStatus(array $productIds, $status)
}
}
- /**
- * Get tag customer grid
- *
- */
- public function tagCustomerGridAction()
- {
- $this->loadLayout();
- $this->getLayout()->getBlock('admin.product.tags.customers')
- ->setProductId($this->getRequest()->getParam('id'));
- $this->renderLayout();
- }
-
public function quickCreateAction()
{
$result = array();
View
569 app/code/core/Mage/Adminhtml/controllers/CustomerController.php
@@ -34,72 +34,18 @@
class Mage_Adminhtml_CustomerController extends Mage_Adminhtml_Controller_Action
{
- /**
- * @var Mage_Core_Model_Config
- */
- protected $_objectFactory;
-
- /**
- * Event manager
- *
- * @var Mage_Core_Model_Event_Manager
- */
- protected $_eventManager;
-
- /**
- * Registry model
- *
- * @var Mage_Core_Model_Registry
- */
- protected $_registryManager;
-
- /**
- * ACL
- *
- * @var Mage_Backend_Model_Auth_Session
- */
- protected $_acl;
-
- /**
- * Constructor
- *
- * @param Zend_Controller_Request_Abstract $request
- * @param Zend_Controller_Response_Abstract $response
- * @param array $invokeArgs
- */
- public function __construct(Zend_Controller_Request_Abstract $request,
- Zend_Controller_Response_Abstract $response,
- array $invokeArgs = array()
- ) {
- parent::__construct($request, $response, $invokeArgs);
-
- $this->_objectFactory = isset($invokeArgs['objectFactory']) ? $invokeArgs['objectFactory'] : Mage::getConfig();
-
- $this->_registryManager = isset($invokeArgs['registry']) ?
- $invokeArgs['registry'] :
- Mage::getSingleton('Mage_Core_Model_Registry');
-
- $this->_acl = isset($invokeArgs['acl']) ?
- $invokeArgs['acl'] :
- Mage::getSingleton('Mage_Core_Model_Authorization');
-
- $this->_eventManager = isset($invokeArgs['eventManager']) ?
- $invokeArgs['eventManager'] :
- Mage::getSingleton('Mage_Core_Model_Event_Manager');
- }
-
protected function _initCustomer($idFieldName = 'id')
{
$this->_title($this->__('Customers'))->_title($this->__('Manage Customers'));
$customerId = (int) $this->getRequest()->getParam($idFieldName);
- $customer = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Customer');
+ $customer = Mage::getModel('Mage_Customer_Model_Customer');
if ($customerId) {
$customer->load($customerId);
}
- $this->_registryManager->register('current_customer', $customer);
+ Mage::register('current_customer', $customer);
return $this;
}
@@ -131,8 +77,8 @@ public function indexAction()
/**
* Add breadcrumb item
*/
- $this->_addBreadcrumb($this->_getHelper()->__('Customers'), $this->_getHelper()->__('Customers'));
- $this->_addBreadcrumb($this->_getHelper()->__('Manage Customers'), $this->_getHelper()->__('Manage Customers'));
+ $this->_addBreadcrumb(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Customers'), Mage::helper('Mage_Adminhtml_Helper_Data')->__('Customers'));
+ $this->_addBreadcrumb(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Manage Customers'), Mage::helper('Mage_Adminhtml_Helper_Data')->__('Manage Customers'));
$this->renderLayout();
}
@@ -152,10 +98,10 @@ public function editAction()
$this->loadLayout();
/* @var $customer Mage_Customer_Model_Customer */
- $customer = $this->_registryManager->registry('current_customer');
+ $customer = Mage::registry('current_customer');
// set entered data if was error when we do save
- $data = $this->_getSession()->getCustomerData(true);
+ $data = Mage::getSingleton('Mage_Adminhtml_Model_Session')->getCustomerData(true);
// restore data from SESSION
if ($data) {
@@ -164,7 +110,7 @@ public function editAction()
if (isset($data['account'])) {
/* @var $customerForm Mage_Customer_Model_Form */
- $customerForm = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Form');
+ $customerForm = Mage::getModel('Mage_Customer_Model_Form');
$customerForm->setEntity($customer)
->setFormCode('adminhtml_customer')
->setIsAjaxRequest(true);
@@ -174,7 +120,7 @@ public function editAction()
if (isset($data['address']) && is_array($data['address'])) {
/* @var $addressForm Mage_Customer_Model_Form */
- $addressForm = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Form');
+ $addressForm = Mage::getModel('Mage_Customer_Model_Form');
$addressForm->setFormCode('adminhtml_customer_address');
foreach (array_keys($data['address']) as $addressId) {
@@ -184,7 +130,7 @@ public function editAction()
$address = $customer->getAddressItemById($addressId);
if (!$address) {
- $address = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Address');
+ $address = Mage::getModel('Mage_Customer_Model_Address');
$customer->addAddress($address);
}
@@ -219,15 +165,15 @@ public function newAction()
public function deleteAction()
{
$this->_initCustomer();
- $customer = $this->_registryManager->registry('current_customer');
+ $customer = Mage::registry('current_customer');
if ($customer->getId()) {
try {
$customer->load($customer->getId());
$customer->delete();
- $this->_getSession()->addSuccess($this->_getHelper()->__('The customer has been deleted.'));
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(Mage::helper('Mage_Adminhtml_Helper_Data')->__('The customer has been deleted.'));
}
catch (Exception $e){
- $this->_getSession()->addError($e->getMessage());
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
}
}
$this->_redirect('*/customer');
@@ -240,64 +186,184 @@ public function saveAction()
{
$data = $this->getRequest()->getPost();
if ($data) {
+ $redirectBack = $this->getRequest()->getParam('back', false);
+ $this->_initCustomer('customer_id');
/** @var $customer Mage_Customer_Model_Customer */
- $this->_initCustomer('customer_id');
- $customer = $this->_registryManager->registry('current_customer');
- if (!$this->_processData($customer, $data)) {
+ $customer = Mage::registry('current_customer');
+
+ /** @var $customerForm Mage_Customer_Model_Form */
+ $customerForm = Mage::getModel('Mage_Customer_Model_Form');
+ $customerForm->setEntity($customer)
+ ->setFormCode('adminhtml_customer')
+ ->ignoreInvisible(false)
+ ;
+
+ $formData = $customerForm->extractData($this->getRequest(), 'account');
+
+ // Handle 'disable auto_group_change' attribute
+ if (isset($formData['disable_auto_group_change'])) {
+ $formData['disable_auto_group_change'] = empty($formData['disable_auto_group_change']) ? '0' : '1';
+ }
+
+ $errors = $customerForm->validateData($formData);
+ if ($errors !== true) {
+ foreach ($errors as $error) {
+ $this->_getSession()->addError($error);
+ }
+ $this->_getSession()->setCustomerData($data);
+ $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
return;
}
+ $customerForm->compactData($formData);
+
// Unset template data
if (isset($data['address']['_template_'])) {
unset($data['address']['_template_']);
}
- if (!$this->_processAddress($customer, $data)) {
- return;
+ $modifiedAddresses = array();
+ if (!empty($data['address'])) {
+ /** @var $addressForm Mage_Customer_Model_Form */
+ $addressForm = Mage::getModel('Mage_Customer_Model_Form');
+ $addressForm->setFormCode('adminhtml_customer_address')->ignoreInvisible(false);
+
+ foreach (array_keys($data['address']) as $index) {
+ $address = $customer->getAddressItemById($index);
+ if (!$address) {
+ $address = Mage::getModel('Mage_Customer_Model_Address');
+ }
+
+ $requestScope = sprintf('address/%s', $index);
+ $formData = $addressForm->setEntity($address)
+ ->extractData($this->getRequest(), $requestScope);
+
+ // Set default billing and shipping flags to address
+ $isDefaultBilling = isset($data['account']['default_billing'])
+ && $data['account']['default_billing'] == $index;
+ $address->setIsDefaultBilling($isDefaultBilling);
+ $isDefaultShipping = isset($data['account']['default_shipping'])
+ && $data['account']['default_shipping'] == $index;
+ $address->setIsDefaultShipping($isDefaultShipping);
+
+ $errors = $addressForm->validateData($formData);
+ if ($errors !== true) {
+ foreach ($errors as $error) {
+ $this->_getSession()->addError($error);
+ }
+ $this->_getSession()->setCustomerData($data);
+ $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array(
+ 'id' => $customer->getId())
+ ));
+ return;
+ }
+
+ $addressForm->compactData($formData);
+
+ // Set post_index for detect default billing and shipping addresses
+ $address->setPostIndex($index);
+
+ if ($address->getId()) {
+ $modifiedAddresses[] = $address->getId();
+ } else {
+ $customer->addAddress($address);
+ }
+ }
+ }
+
+ // Default billing and shipping
+ if (isset($data['account']['default_billing'])) {
+ $customer->setData('default_billing', $data['account']['default_billing']);
+ }
+ if (isset($data['account']['default_shipping'])) {
+ $customer->setData('default_shipping', $data['account']['default_shipping']);
+ }
+ if (isset($data['account']['confirmation'])) {
+ $customer->setData('confirmation', $data['account']['confirmation']);
+ }
+
+ // Mark not modified customer addresses for delete
+ foreach ($customer->getAddressesCollection() as $customerAddress) {
+ if ($customerAddress->getId() && !in_array($customerAddress->getId(), $modifiedAddresses)) {
+ $customerAddress->setData('_deleted', true);
+ }
+ }
+
+ if (Mage::getSingleton('Mage_Core_Model_Authorization')
+ ->isAllowed(Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL)
+ && !$customer->getConfirmation()
+ ) {
+ $customer->setIsSubscribed(isset($data['subscription']));
}
- $this->_processSubscriptionOptions($customer, $data);
+ if (isset($data['account']['sendemail_store_id'])) {
+ $customer->setSendemailStoreId($data['account']['sendemail_store_id']);
+ }
$isNewCustomer = $customer->isObjectNew();
try {
$sendPassToEmail = false;
// Force new customer confirmation
if ($isNewCustomer) {
- $sendPassToEmail = $this->_processPassword($customer, $data);
+ $customer->setPassword($data['account']['password']);
+ $customer->setForceConfirmed(true);
+ if ($customer->getPassword() == 'auto') {
+ $sendPassToEmail = true;
+ $customer->setPassword($customer->generatePassword());
+ }
}
- $this->_eventManager->dispatch(
- 'adminhtml_customer_prepare_save',
- array('customer' => $customer, 'request' => $this->getRequest())
- );
+ Mage::dispatchEvent('adminhtml_customer_prepare_save', array(
+ 'customer' => $customer,
+ 'request' => $this->getRequest()
+ ));
$customer->save();
// Send welcome email
- $data = $this->_sendWelcomeEmail($customer, $data, $sendPassToEmail, $isNewCustomer);
+ if ($customer->getWebsiteId() && (isset($data['account']['sendemail']) || $sendPassToEmail)) {
+ $storeId = $customer->getSendemailStoreId();
+ if ($isNewCustomer) {
+ $customer->sendNewAccountEmail('registered', '', $storeId);
+ } elseif ((!$customer->getConfirmation())) {
+ // Confirm not confirmed customer
+ $customer->sendNewAccountEmail('confirmed', '', $storeId);
+ }
+ }
- $data = $this->_changePassword($customer, $data);
+ if (!empty($data['account']['new_password'])) {
+ $newPassword = $data['account']['new_password'];
+ if ($newPassword == 'auto') {
+ $newPassword = $customer->generatePassword();
+ }
+ $customer->changePassword($newPassword);
+ $customer->sendPasswordReminderEmail();
+ }
- $this->_session->addSuccess($this->_getHelper()->__('The customer has been saved.'));
- $this->_eventManager->dispatch(
- 'adminhtml_customer_save_after',
- array('customer' => $customer, 'request' => $this->getRequest())
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('The customer has been saved.')
);
+ Mage::dispatchEvent('adminhtml_customer_save_after', array(
+ 'customer' => $customer,
+ 'request' => $this->getRequest()
+ ));
- if ($this->getRequest()->getParam('back', false)) {
- $this->_redirect('*/*/edit', array( 'id' => $customer->getId(), '_current' => true));
+ if ($redirectBack) {
+ $this->_redirect('*/*/edit', array(
+ 'id' => $customer->getId(),
+ '_current' => true
+ ));
return;
}
} catch (Mage_Core_Exception $e) {
- $this->_session->addError($e->getMessage());
- $this->_session->setCustomerData($data);
+ $this->_getSession()->addError($e->getMessage());
+ $this->_getSession()->setCustomerData($data);
$this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
- return;
} catch (Exception $e) {
- $this->_session->addException($e,
- $this->_getHelper()->__('An error occurred while saving the customer.'));
- $this->_session->setCustomerData($data);
+ $this->_getSession()->addException($e,
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('An error occurred while saving the customer.'));
+ $this->_getSession()->setCustomerData($data);
$this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id'=>$customer->getId())));
return;
}
@@ -306,211 +372,6 @@ public function saveAction()
}
/**
- * Set customer password
- *
- * @param Mage_Customer_Model_Customer $customer
- * @param array $data
- * @return bool
- */
- protected function _processPassword($customer, $data)
- {
- $customer->setPassword($data['account']['password']);
- $customer->setForceConfirmed(true);
- if ($customer->getPassword() == 'auto') {
- $customer->setPassword($customer->generatePassword());
- return true;
- }
- return false;
- }
-
- /**
- * Process subscription options
- *
- * @param Mage_Customer_Model_Customer $customer
- * @param array $data
- */
- protected function _processSubscriptionOptions($customer, $data)
- {
- if (isset($data['account']['confirmation'])) {
- $customer->setData('confirmation', $data['account']['confirmation']);
- }
-
- if ($this->_acl->isAllowed(Mage_Backend_Model_Acl_Config::ACL_RESOURCE_ALL)
- && !$customer->getConfirmation()
- ) {
- $customer->setIsSubscribed(isset($data['subscription']));
- }
-
- if (isset($data['account']['sendemail_store_id'])) {
- $customer->setSendemailStoreId($data['account']['sendemail_store_id']);
- }
- }
-
- /**
- * Change Password
- *
- * @param Mage_Customer_Model_Customer $customer
- * @param array $data
- * @return mixed
- */
- protected function _changePassword($customer, $data)
- {
- if (!empty($data['account']['new_password'])) {
- $newPassword = $data['account']['new_password'];
- if ($newPassword == 'auto') {
- $newPassword = $customer->generatePassword();
- }
- $customer->changePassword($newPassword);
- $customer->sendPasswordReminderEmail();
- return $data;
- }
- return $data;
- }
-
- /**
- * @param Mage_Customer_Model_Customer $customer
- * @param array $data
- * @param bool $sendPassToEmail
- * @param bool $isNewCustomer
- * @return mixed
- */
- protected function _sendWelcomeEmail($customer, $data, $sendPassToEmail, $isNewCustomer)
- {
- if ($customer->getWebsiteId() && (isset($data['account']['sendemail']) || $sendPassToEmail)) {
- $storeId = $customer->getSendemailStoreId();
- if ($isNewCustomer) {
- $customer->sendNewAccountEmail('registered', '', $storeId);
- return $data;
- } elseif ((!$customer->getConfirmation())) {
- // Confirm not confirmed customer
- $customer->sendNewAccountEmail('confirmed', '', $storeId);
- return $data;
- }
- return $data;
- }
- return $data;
- }
-
- /**
- * Process customer address
- *
- * @param Mage_Customer_Model_Customer $customer
- * @param array $data
- * @return bool
- */
- protected function _processAddress($customer, $data)
- {
- $modifiedAddresses = array();
- if (!empty($data['address'])) {
- $modifiedAddresses = $this->_processAddresses($customer, $data);
- if ($modifiedAddresses === false) {
- return false;
- }
- }
-
- // Default billing and shipping
- if (isset($data['account']['default_billing'])) {
- $customer->setData('default_billing', $data['account']['default_billing']);
- }
- if (isset($data['account']['default_shipping'])) {
- $customer->setData('default_shipping', $data['account']['default_shipping']);
- }
-
- // Mark not modified customer addresses for delete
- /** @var $customerAddress Mage_Customer_Model_Address */
- foreach ($customer->getAddressesCollection() as $customerAddress) {
- if ($customerAddress->getId() && !in_array($customerAddress->getId(), $modifiedAddresses)) {
- $customerAddress->setData('_deleted', true);
- }
- }
- return true;
- }
-
- protected function _processData($customer, $data)
- {
- /** @var $customerForm Mage_Customer_Model_Form */
- $customerForm = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Form');
- $customerForm->setEntity($customer)
- ->setFormCode('adminhtml_customer')
- ->ignoreInvisible(false);
-
- $formData = $customerForm->extractData($this->getRequest(), 'account');
-
- // Handle 'disable auto_group_change' attribute
- if (isset($formData['disable_auto_group_change'])) {
- $formData['disable_auto_group_change'] = empty($formData['disable_auto_group_change']) ? '0' : '1';
- }
-
- $errors = $customerForm->validateData($formData);
- if ($errors !== true) {
- foreach ($errors as $error) {
- $this->_session->addError($error);
- }
- $this->_session->setCustomerData($data);
- $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array('id' => $customer->getId())));
- return false;
- }
-
- $customerForm->compactData($formData);
- return true;
- }
-
- /**
- * @param array $data
- * @param Mage_Customer_Model_Customer $customer
- * @return array
- */
- protected function _processAddresses($customer, $data)
- {
- /** @var $addressForm Mage_Customer_Model_Form */
- $addressForm = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Form');
- $addressForm->setFormCode('adminhtml_customer_address')->ignoreInvisible(false);
-
- $modifiedAddresses = array();
- foreach (array_keys($data['address']) as $index) {
- $address = $customer->getAddressItemById($index);
- if (!$address) {
- $address = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Address');
- }
-
- $requestScope = sprintf('address/%s', $index);
- $formData = $addressForm->setEntity($address)
- ->extractData($this->getRequest(), $requestScope);
-
- // Set default billing and shipping flags to address
- $isDefaultBilling = isset($data['account']['default_billing'])
- && $data['account']['default_billing'] == $index;
- $address->setIsDefaultBilling($isDefaultBilling);
- $isDefaultShipping = isset($data['account']['default_shipping'])
- && $data['account']['default_shipping'] == $index;
- $address->setIsDefaultShipping($isDefaultShipping);
-
- $errors = $addressForm->validateData($formData);
- if ($errors !== true) {
- foreach ($errors as $error) {
- $this->_session->addError($error);
- }
- $this->_session->setCustomerData($data);
- $this->getResponse()->setRedirect($this->getUrl('*/customer/edit', array(
- 'id' => $customer->getId())
- ));
- return false;
- }
-
- $addressForm->compactData($formData);
-
- // Set post_index for detect default billing and shipping addresses
- $address->setPostIndex($index);
- if ($address->getId()) {
- $modifiedAddresses[] = $address->getId();
- } else {
- $customer->addAddress($address);
- }
- }
- return $modifiedAddresses;
- }
-
- /**
* Export customer grid to CSV format
*/
public function exportCsvAction()
@@ -538,8 +399,7 @@ public function exportXmlAction()
* Customer orders grid
*
*/
- public function ordersAction()
- {
+ public function ordersAction() {
$this->_initCustomer();
$this->loadLayout();
$this->renderLayout();
@@ -549,8 +409,7 @@ public function ordersAction()
* Customer last orders grid for ajax
*
*/
- public function lastOrdersAction()
- {
+ public function lastOrdersAction() {
$this->_initCustomer();
$this->loadLayout();
$this->renderLayout();
@@ -563,10 +422,10 @@ public function lastOrdersAction()
public function newsletterAction()
{
$this->_initCustomer();
- $subscriber = $this->_objectFactory->getModelInstance('Mage_Newsletter_Model_Subscriber')
- ->loadByCustomer($this->_registryManager->registry('current_customer'));
+ $subscriber = Mage::getModel('Mage_Newsletter_Model_Subscriber')
+ ->loadByCustomer(Mage::registry('current_customer'));
- $this->_registryManager->register('subscriber', $subscriber);
+ Mage::register('subscriber', $subscriber);
$this->loadLayout()
->renderLayout();
}
@@ -574,11 +433,11 @@ public function newsletterAction()
public function wishlistAction()
{
$this->_initCustomer();
- $customer = $this->_registryManager->registry('current_customer');
+ $customer = Mage::registry('current_customer');
if ($customer->getId()) {
- if ($itemId = (int) $this->getRequest()->getParam('delete')) {
+ if($itemId = (int) $this->getRequest()->getParam('delete')) {
try {
- $this->_objectFactory->getModelInstance('Mage_Wishlist_Model_Item')->load($itemId)
+ Mage::getModel('Mage_Wishlist_Model_Item')->load($itemId)
->delete();
}
catch (Exception $e) {
@@ -618,9 +477,9 @@ public function cartAction()
// delete an item from cart
$deleteItemId = $this->getRequest()->getPost('delete');
if ($deleteItemId) {
- $quote = $this->_objectFactory->getModelInstance('Mage_Sales_Model_Quote')
+ $quote = Mage::getModel('Mage_Sales_Model_Quote')
->setWebsite(Mage::app()->getWebsite($websiteId))
- ->loadByCustomer($this->_registryManager->registry('current_customer'));
+ ->loadByCustomer(Mage::registry('current_customer'));
$item = $quote->getItemById($deleteItemId);
if ($item && $item->getId()) {
$quote->removeItem($deleteItemId);
@@ -640,7 +499,7 @@ public function cartAction()
public function viewCartAction()
{
$this->_initCustomer();
- $this->loadLayout()
+ $layout = $this->loadLayout()
->getLayout()
->getBlock('admin.customer.view.cart')
->setWebsiteId();
@@ -668,36 +527,11 @@ public function productReviewsAction()
$this->loadLayout()
->getLayout()
->getBlock('admin.customer.reviews')
- ->setCustomerId($this->_registryManager->registry('current_customer')->getId())
+ ->setCustomerId(Mage::registry('current_customer')->getId())
->setUseAjax(true);
$this->renderLayout();
}
- /**
- * Get customer's tags list
- *
- */
- public function productTagsAction()
- {
- $this->_initCustomer();
- $this->loadLayout()
- ->getLayout()
- ->getBlock('admin.customer.tags')
- ->setCustomerId($this->_registryManager->registry('current_customer')->getId())
- ->setUseAjax(true);
- $this->renderLayout();
- }
-
- public function tagGridAction()
- {
- $this->_initCustomer();
- $this->loadLayout();
- $this->getLayout()->getBlock('admin.customer.tags')->setCustomerId(
- $this->_registryManager->registry('current_customer')
- );
- $this->renderLayout();
- }
-
public function validateAction()
{
$response = new Varien_Object();
@@ -705,7 +539,7 @@ public function validateAction()
$websiteId = Mage::app()->getStore()->getWebsiteId();
$accountData = $this->getRequest()->getPost('account');
- $customer = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Customer');
+ $customer = Mage::getModel('Mage_Customer_Model_Customer');
$customerId = $this->getRequest()->getParam('id');
if ($customerId) {
$customer->load($customerId);
@@ -715,7 +549,7 @@ public function validateAction()
}
/* @var $customerForm Mage_Customer_Model_Form */
- $customerForm = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Form');
+ $customerForm = Mage::getModel('Mage_Customer_Model_Form');
$customerForm->setEntity($customer)
->setFormCode('adminhtml_customer')
->setIsAjaxRequest(true)
@@ -735,13 +569,13 @@ public function validateAction()
if (!$response->getError()) {
# Trying to load customer with the same email and return error message
# if customer with the same email address exisits
- $checkCustomer = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Customer')
+ $checkCustomer = Mage::getModel('Mage_Customer_Model_Customer')
->setWebsiteId($websiteId);
$checkCustomer->loadByEmail($accountData['email']);
if ($checkCustomer->getId() && ($checkCustomer->getId() != $customer->getId())) {
$response->setError(1);
$this->_getSession()->addError(
- $this->_getHelper()->__('Customer with the same email already exists.')
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Customer with the same email already exists.')
);
}
}
@@ -749,7 +583,7 @@ public function validateAction()
$addressesData = $this->getRequest()->getParam('address');
if (is_array($addressesData)) {
/* @var $addressForm Mage_Customer_Model_Form */
- $addressForm = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Form');
+ $addressForm = Mage::getModel('Mage_Customer_Model_Form');
$addressForm->setFormCode('adminhtml_customer_address')->ignoreInvisible(false);
foreach (array_keys($addressesData) as $index) {
if ($index == '_template_') {
@@ -757,7 +591,7 @@ public function validateAction()
}
$address = $customer->getAddressItemById($index);
if (!$address) {
- $address = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Address');
+ $address = Mage::getModel('Mage_Customer_Model_Address');
}
$requestScope = sprintf('address/%s', $index);
@@ -785,22 +619,21 @@ public function validateAction()
public function massSubscribeAction()
{
$customersIds = $this->getRequest()->getParam('customer');
- if (!is_array($customersIds)) {
- $this->_getSession()->addError($this->_getHelper()->__('Please select customer(s).'));
+ if(!is_array($customersIds)) {
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Please select customer(s).'));
} else {
try {
foreach ($customersIds as $customerId) {
- $customer = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Customer')
- ->load($customerId);
+ $customer = Mage::getModel('Mage_Customer_Model_Customer')->load($customerId);
$customer->setIsSubscribed(true);
$customer->save();
}
- $this->_getSession()->addSuccess(
- $this->_getHelper()->__('Total of %d record(s) were updated.', count($customersIds))
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) were updated.', count($customersIds))
);
} catch (Exception $e) {
- $this->_getSession()->addError($e->getMessage());
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
}
}
$this->_redirect('*/*/index');
@@ -809,21 +642,20 @@ public function massSubscribeAction()
public function massUnsubscribeAction()
{
$customersIds = $this->getRequest()->getParam('customer');
- if (!is_array($customersIds)) {
- $this->_getSession()->addError($this->_getHelper()->__('Please select customer(s).'));
+ if(!is_array($customersIds)) {
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Please select customer(s).'));
} else {
try {
foreach ($customersIds as $customerId) {
- $customer = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Customer')
- ->load($customerId);
+ $customer = Mage::getModel('Mage_Customer_Model_Customer')->load($customerId);
$customer->setIsSubscribed(false);
$customer->save();
}
- $this->_getSession()->addSuccess(
- $this->_getHelper()->__('Total of %d record(s) were updated.', count($customersIds))
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) were updated.', count($customersIds))
);
} catch (Exception $e) {
- $this->_getSession()->addError($e->getMessage());
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
}
}
@@ -833,21 +665,21 @@ public function massUnsubscribeAction()
public function massDeleteAction()
{
$customersIds = $this->getRequest()->getParam('customer');
- if (!is_array($customersIds)) {
- $this->_getSession()->addError($this->_getHelper()->__('Please select customer(s).'));
+ if(!is_array($customersIds)) {
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Please select customer(s).'));
} else {
try {
- $customer = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Customer');
+ $customer = Mage::getModel('Mage_Customer_Model_Customer');
foreach ($customersIds as $customerId) {
$customer->reset()
->load($customerId)
->delete();
}
- $this->_getSession()->addSuccess(
- $this->_getHelper()->__('Total of %d record(s) were deleted.', count($customersIds))
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) were deleted.', count($customersIds))
);
} catch (Exception $e) {
- $this->_getSession()->addError($e->getMessage());
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
}
}
@@ -857,21 +689,20 @@ public function massDeleteAction()
public function massAssignGroupAction()
{
$customersIds = $this->getRequest()->getParam('customer');
- if (!is_array($customersIds)) {
- $this->_getSession()->addError($this->_getHelper()->__('Please select customer(s).'));
+ if(!is_array($customersIds)) {
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError(Mage::helper('Mage_Adminhtml_Helper_Data')->__('Please select customer(s).'));
} else {
try {
foreach ($customersIds as $customerId) {
- $customer = $this->_objectFactory->getModelInstance('Mage_Customer_Model_Customer')
- ->load($customerId);
+ $customer = Mage::getModel('Mage_Customer_Model_Customer')->load($customerId);
$customer->setGroupId($this->getRequest()->getParam('group'));
$customer->save();
}
- $this->_getSession()->addSuccess(
- $this->_getHelper()->__('Total of %d record(s) were updated.', count($customersIds))
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addSuccess(
+ Mage::helper('Mage_Adminhtml_Helper_Data')->__('Total of %d record(s) were updated.', count($customersIds))
);
} catch (Exception $e) {
- $this->_getSession()->addError($e->getMessage());
+ Mage::getSingleton('Mage_Adminhtml_Model_Session')->addError($e->getMessage());
}
}
@@ -952,7 +783,7 @@ public function viewfileAction()
protected function _isAllowed()
{
- return $this->_acl->isAllowed('Mage_Customer::manage');
+ return Mage::getSingleton('Mage_Core_Model_Authorization')->isAllowed('Mage_Customer::manage');
}
/**
View
7 app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
@@ -721,11 +721,8 @@ public function transactionsAction()
public function addressAction()
{
$addressId = $this->getRequest()->getParam('address_id');
- $address = Mage::getModel('Mage_Sales_Model_Order_Address')
- ->getCollection()
- ->addFilter('entity_id', $addressId)
- ->getItemById($addressId);
- if ($address) {
+ $address = Mage::getModel('Mage_Sales_Model_Order_Address')->load($addressId);
+ if ($address->getId()) {
Mage::register('order_address', $address);
$this->loadLayout();
// Do not display VAT validation button on edit order address form
View
3  app/code/core/Mage/Adminhtml/etc/config.xml
@@ -148,9 +148,6 @@
<sales module="Mage_Adminhtml">
<file>sales.xml</file>
</sales>
- <tag module="Mage_Adminhtml">
- <file>tag.xml</file>
- </tag>
</updates>
</layout>
<sales>
View
12 app/code/core/Mage/Adminhtml/view/adminhtml/catalog.xml
@@ -100,18 +100,6 @@
</container>
</adminhtml_catalog_product_reviews>
- <adminhtml_catalog_product_taggrid>
- <container name="root" label="Root" output="1">
- <block type="Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Tag" name="admin.product.tags"/>
- </container>
- </adminhtml_catalog_product_taggrid>
-
- <adminhtml_catalog_product_tagcustomergrid>
- <container name="root" label="Root" output="1">
- <block type="Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Tag_Customer" name="admin.product.tags.customers"/>
- </container>
- </adminhtml_catalog_product_tagcustomergrid>
-
<adminhtml_catalog_product_options>
<container name="root" label="Root" output="1">
<block type="Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Options" name="admin.product.options"/>
View
12 app/code/core/Mage/Adminhtml/view/adminhtml/customer.xml
@@ -94,18 +94,6 @@
</container>
</adminhtml_customer_productreviews>
- <adminhtml_customer_producttags>
- <container name="root" label="Root" output="1">
- <block type="Mage_Adminhtml_Block_Customer_Edit_Tab_Tag" name="admin.customer.tags"/>
- </container>
- </adminhtml_customer_producttags>
-
- <adminhtml_customer_taggrid>
- <container name="root" label="Root" output="1">
- <block type="Mage_Adminhtml_Block_Customer_Edit_Tab_Tag" name="admin.customer.tags"/>
- </container>
- </adminhtml_customer_taggrid>
-
<adminhtml_customer_newsletter>
<container name="root" label="Root" output="1">
<block type="Mage_Adminhtml_Block_Customer_Edit_Tab_Newsletter_Grid" name="admin.customer.newsletter.grid"/>
View
2  app/code/core/Mage/Adminhtml/view/adminhtml/notification/toolbar.phtml
@@ -77,7 +77,7 @@
<?php echo $this->__('Latest Message:') ?></strong> <?php echo $this->getLatestNotice() ?>
<?php if (!empty($latestNoticeUrl)): ?>
- <a href="<?php echo $latestNoticeUrl ?>" onclick="this.target='_blank';"><?php echo $this->__('Read details') ?></a>
+ <a href="<?php echo $this->escapeHtml($latestNoticeUrl) ?>" onclick="this.target='_blank';"><?php echo $this->__('Read details') ?></a>
<?php endif; ?>
</div>
<?php endif; ?>
View
56 app/code/core/Mage/Catalog/Helper/Product/View.php
@@ -27,6 +27,8 @@
/**
* Catalog category helper
*
+ * @category Mage
+ * @package Mage_Catalog
* @author Magento Core Team <core@magentocommerce.com>
*/
class Mage_Catalog_Helper_Product_View extends Mage_Core_Helper_Abstract
@@ -35,7 +37,33 @@ class Mage_Catalog_Helper_Product_View extends Mage_Core_Helper_Abstract
public $ERR_NO_PRODUCT_LOADED = 1;
public $ERR_BAD_CONTROLLER_INTERFACE = 2;
- /**
+ /**
+ * Path to list of session models to get messages
+ */
+ const XML_PATH_SESSION_MESSAGE_MODELS = 'global/session/catalog/product/message_models';
+
+ /**
+ * General config object
+ *
+ * @var Mage_Core_Model_Config
+ */
+ protected $_config;
+
+ /**
+ * Constructor dependency injection
+ *
+ * @param array $data
+ */
+ public function __construct(array $data = array())
+ {
+ if (isset($data['config'])) {
+ $this->_config = $data['config'];
+ } else {
+ $this->_config = Mage::getConfig();
+ }
+ }
+
+ /**
* Inits layout for viewing product page
*
* @param Mage_Catalog_Model_Product $product
@@ -61,7 +89,7 @@ public function initProductLayout($product, $controller)
$layoutUpdates = $settings->getLayoutUpdates();
if ($layoutUpdates) {
if (is_array($layoutUpdates)) {
- foreach($layoutUpdates as $layoutUpdate) {
+ foreach ($layoutUpdates as $layoutUpdate) {
$update->addUpdate($layoutUpdate);
}
}
@@ -105,6 +133,7 @@ public function initProductLayout($product, $controller)
* @param null|Varien_Object $params
*
* @return Mage_Catalog_Helper_Product_View
+ * @throws Mage_Core_Exception
*/
public function prepareAndRender($productId, $controller, $params = null)
{
@@ -141,14 +170,29 @@ public function prepareAndRender($productId, $controller, $params = null)
$this->initProductLayout($product, $controller);
if ($controller instanceof Mage_Catalog_Controller_Product_View_Interface) {
- $controller->initLayoutMessages('Mage_Catalog_Model_Session');
- $controller->initLayoutMessages('Mage_Tag_Model_Session');
- $controller->initLayoutMessages('Mage_Checkout_Model_Session');
+ foreach ($this->_getSessionMessageModels() as $sessionModel) {
+ $controller->initLayoutMessages($sessionModel);
+ }
} else {
- throw new Mage_Core_Exception($this->__('Bad controller interface for showing product'), $this->ERR_BAD_CONTROLLER_INTERFACE);
+ throw new Mage_Core_Exception(
+ $this->__('Bad controller interface for showing product'),
+ $this->ERR_BAD_CONTROLLER_INTERFACE
+ );
}
$controller->renderLayout();
return $this;
}
+
+ /**
+ * Get list of session models with messages
+ *
+ * @return array
+ */
+ protected function _getSessionMessageModels()
+ {
+ $messageModels = $this->_config->getNode(self::XML_PATH_SESSION_MESSAGE_MODELS)
+ ->asArray();
+ return array_values($messageModels);
+ }
}
View
10 app/code/core/Mage/Catalog/etc/config.xml
@@ -247,6 +247,16 @@
</visibility>
</catalog_product>
</eav_attributes>
+ <session>
+ <catalog>
+ <product>
+ <message_models>
+ <catalog>Mage_Catalog_Model_Session</catalog>
+ <checkout>Mage_Checkout_Model_Session</checkout>
+ </message_models>
+ </product>
+ </catalog>
+ </session>
</global>
<adminhtml>
<translate>
View
4 app/code/core/Mage/CatalogSearch/view/frontend/result.phtml
@@ -27,9 +27,7 @@
<?php if($this->getResultCount()): ?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<div class="page-title">
- <?php if ($this->helper('Mage_Rss_Helper_Catalog')->getTagFeedUrl()): ?>
- <a href="<?php echo $this->helper('Mage_Rss_Helper_Catalog')->getTagFeedUrl() ?>" class="nobr link-rss"><?php echo $this->__('Subscribe to Feed') ?></a>
- <?php endif; ?>
+ <?php echo $this->getChildHtml('tagged_product_list_rss_link'); ?>
<h1><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('Mage_CatalogSearch_Helper_Data')->getEscapedQueryText()) ?></h1>
</div>
<?php if ($messages = $this->getNoteMessages()):?>
View
3  app/code/core/Mage/Core/Helper/Js.php
@@ -112,7 +112,8 @@ protected function _getTranslateData()
foreach ($messages as $message) {
$messageText = (string)$message;
$module = $message->getParent()->getAttribute("module");
- $this->_translateData[$messageText] = Mage::helper(empty($module) ? 'Mage_Core' : $module
+ $this->_translateData[$messageText] = Mage::helper(
+ empty($module) ? 'Mage_Core' : $module
)->__($messageText);
}
}
View
23 app/code/core/Mage/DesignEditor/Block/Template.php
@@ -26,6 +26,13 @@
/**
* Extended template block for Visual Design Editor
+ *
+ * @method string getElementName()
+ * @method string getElementId()
+ * @method string getElementHtml()
+ * @method string getElementTitle()
+ * @method bool getIsManipulationAllowed()
+ * @method bool getIsContainer()
*/
class Mage_DesignEditor_Block_Template extends Mage_Core_Block_Template
{
@@ -38,4 +45,20 @@ public function isHighlightingDisabled()
{
return Mage::getSingleton('Mage_DesignEditor_Model_Session')->isHighlightingDisabled();
}
+
+ /**
+ * Get remove button for block/container wrapper
+ *
+ * @param string $elementId
+ * @return string
+ */
+ public function getRemoveButton($elementId)
+ {
+ /** @var $block Mage_DesignEditor_Block_Wrapper_Remove */
+ $block = Mage::getModel('Mage_DesignEditor_Block_Wrapper_Remove', array(
+ 'template' => 'wrapper/remove.phtml',
+ 'wrapped_element_id' => $elementId
+ ));
+ return $block->toHtml();
+ }
}
View
15 app/code/core/Mage/DesignEditor/Block/Toolbar.php
@@ -64,8 +64,21 @@ public function getMessages()
public function getOptionsJson()
{
$options = array(
- 'cookie_highlighting_name' => Mage_DesignEditor_Model_Session::COOKIE_HIGHLIGHTING,
+ 'cookieHighlightingName' => Mage_DesignEditor_Model_Session::COOKIE_HIGHLIGHTING,
);
+ /** @var $toolbarRowBlock Mage_DesignEditor_Block_Template */
+ $toolbarRowBlock = $this->getChildBlock('design_editor_toolbar_row');
+
+ if ($toolbarRowBlock) {
+ /** @var $buttonsBlock Mage_DesignEditor_Block_Toolbar_Buttons */
+ $buttonsBlock = $toolbarRowBlock->getChildBlock('design_editor_toolbar_buttons');
+ if ($buttonsBlock) {
+ $options['compactLogUrl'] = $buttonsBlock->getCompactLogUrl();
+ $options['viewLayoutUrl'] = $buttonsBlock->getViewLayoutUrl();
+ $options['baseUrl'] = Mage::getBaseUrl();
+ }
+ }
+
return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($options);
}
}
View
61 app/code/core/Mage/DesignEditor/Block/Toolbar/Buttons.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Mage
+ * @package Mage_DesignEditor
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * Exit button control block
+ */
+class Mage_DesignEditor_Block_Toolbar_Buttons extends Mage_Core_Block_Template
+{
+ /**
+ * Get exit editor URL
+ *
+ * @return string
+ */
+ public function getExitUrl()
+ {
+ return Mage::getSingleton('Mage_Adminhtml_Model_Url')->getUrl('adminhtml/system_design_editor/exit');
+ }
+
+ /**
+ * Get "View Layout" button URL
+ *
+ * @return string
+ */
+ public function getViewLayoutUrl()
+ {
+ return $this->getUrl('design/editor/compactXml');
+ }
+
+ /**
+ * Get "Compact Log" button URL
+ *
+ * @return string
+ */
+ public function getCompactLogUrl()
+ {
+ return $this->getUrl('design/editor/compactHistory');
+ }
+}
View
10 ...ode/core/Mage/DesignEditor/Block/Toolbar/Exit.php → .../core/Mage/DesignEditor/Block/Toolbar/History.php
@@ -25,17 +25,17 @@
*/
/**
- * Exit button control block
+ * History toolbar block
*/
-class Mage_DesignEditor_Block_Toolbar_Exit extends Mage_Core_Block_Template
+class Mage_DesignEditor_Block_Toolbar_History extends Mage_Core_Block_Template
{
/**
- * Get exit editor URL
+ * Get block title
*
* @return string
*/
- public function getExitUrl()
+ public function getTitle()
{
- return Mage::getSingleton('Mage_Adminhtml_Model_Url')->getUrl('adminhtml/system_design_editor/exit');
+ return $this->__('Changes history');
}
}
View
43 app/code/core/Mage/DesignEditor/Block/Wrapper/Remove.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Mage
+ * @package Mage_DesignEditor
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * Remove button for template block for Visual Design Editor
+ *
+ * @method string getWrappedElementId()
+ */
+class Mage_DesignEditor_Block_Wrapper_Remove extends Mage_Core_Block_Template
+{
+ /**
+ * Build remove button HTML id
+ *
+ * @return string
+ */
+ public function getElementId()
+ {
+ return $this->getWrappedElementId() . '_remove';
+ }
+}
View
143 app/code/core/Mage/DesignEditor/Model/History.php
@@ -0,0 +1,143 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Mage
+ * @package Mage_DesignEditor
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * Visual Design Editor history model
+ */
+class Mage_DesignEditor_Model_History extends Mage_Backend_Model_Auth_Session
+{
+ /**
+ * Required change fields
+ *
+ * @var array
+ */
+ protected $_requiredFields = array('handle', 'change_type', 'element_name', 'action_name');
+
+
+ /**
+ * Change log
+ *
+ * @var array
+ */
+ protected $_changeLog = array();
+
+ /**
+ * Manager model
+ *
+ * @var null|Mage_DesignEditor_Model_History_Manager
+ */
+ protected $_managerModel;
+
+ /**
+ * Get compact log
+ *
+ * @return array
+ */
+ public function getCompactLog()
+ {
+ return $this->_compactLog()->_getManagerModel()->getHistoryLog();
+ }
+
+ /**
+ * Get compact xml
+ *
+ * @return string
+ */
+ public function getCompactXml()
+ {
+ return $this->_compactLog()->_getManagerModel()->getXml();
+ }
+
+ /**
+ * Set change log
+ *
+ * @param array $changeLog
+ * @return Mage_DesignEditor_Model_History
+ */
+ public function setChangeLog($changeLog)
+ {
+ $this->_changeLog = $changeLog;
+ return $this;
+ }
+
+ /**
+ * Compact log
+ *
+ * @return Mage_DesignEditor_Model_History
+ */
+ protected function _compactLog()
+ {
+ $managerModel = $this->_getManagerModel();
+ foreach ($this->_getChangeLog() as $change) {
+ $this->_validateChange($change);
+ $managerModel->addChange($change);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get change log
+ *
+ * @return array
+ */
+ protected function _getChangeLog()
+ {
+ return $this->_changeLog;
+ }
+
+ /**
+ * Get change model
+ *
+ * @return Mage_DesignEditor_Model_History_Manager
+ */
+ protected function _getManagerModel()
+ {
+ if ($this->_managerModel == null) {
+ $this->_managerModel = Mage::getModel('Mage_DesignEditor_Model_History_Manager');
+ }
+ return $this->_managerModel;
+ }
+
+ /**
+ * Validate change
+ *
+ * @throws Mage_DesignEditor_Exception
+ * @param array $change
+ * @return Mage_DesignEditor_Model_History
+ */
+ protected function _validateChange($change)
+ {
+ foreach ($this->_requiredFields as $field) {
+ if (!is_array($change) || !array_key_exists($field, $change) || empty($change[$field])) {
+ throw new Mage_DesignEditor_Exception(
+ Mage::helper('Mage_DesignEditor_Helper_Data')->__('Invalid change data')
+ );
+ }
+ }
+ return $this;
+ }
+}
View
83 app/code/core/Mage/DesignEditor/Model/History/Manager.php
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Mage
+ * @package Mage_DesignEditor
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * Visual design editor manager model
+ */
+class Mage_DesignEditor_Model_History_Manager extends Mage_Core_Model_Abstract
+{
+ /**
+ * Change collection
+ *
+ * @var null|Mage_DesignEditor_Model_History_Manager_Collection
+ */
+ protected $_changeCollection;
+
+ /**
+ * Add change
+ *
+ * @param array $change
+ * @return Mage_DesignEditor_Model_History_Manager
+ */
+ public function addChange($change)
+ {
+ $this->_getChangeCollection()->addElement($change);
+ return $this;
+ }
+
+ /**
+ * Get history log
+ *
+ * @return array
+ */
+ public function getHistoryLog()
+ {
+ return $this->_getChangeCollection()->toHistoryLog();
+ }
+
+ /**
+ * Get xml changes
+ *
+ * @return string
+ */
+ public function getXml()
+ {
+ return $this->_getChangeCollection()->toXml();
+ }
+
+ /**
+ * Get change collection
+ *
+ * @return Mage_DesignEditor_Model_History_Manager_Collection
+ */
+ protected function _getChangeCollection()
+ {
+ if ($this->_changeCollection == null) {
+ $this->_changeCollection = Mage::getModel('Mage_DesignEditor_Model_History_Manager_Collection');
+ }
+ return $this->_changeCollection;
+ }
+}
View
58 app/code/core/Mage/DesignEditor/Model/History/Manager/Adapter.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @category Mage
+ * @package Mage_DesignEditor
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
+ */
+
+/**
+ * Visual design editor manager adapter
+ */
+class Mage_DesignEditor_Model_History_Manager_Adapter extends Mage_Core_Model_Abstract
+{
+ /**
+ * Layout change type
+ */
+ const CHANGE_TYPE_LAYOUT = 'layout';
+
+ /**
+ * Get change by type
+ *
+ * @static
+ * @throws Mage_DesignEditor_Exception
+ * @param string $adapter
+ * @return Mage_DesignEditor_Model_History_Manager_Adapter_Abstract
+ */
+ public static function factory($adapter)
+ {
+ switch ($adapter) {
+ case self::CHANGE_TYPE_LAYOUT:
+ return Mage::getModel('Mage_DesignEditor_Model_History_Manager_Adapter_Layout');
+ break;
+ default: