Skip to content

Commit 1617a6e

Browse files
committed
Update as of 7/19/2012
* Implemented inheritance of locales. Inheritance is declared in `app/locale/<locale_name>/config.xml` * Moved declaration of modules from `app/etc/modules/<module>.xml` to `app/code/<pool>/<namespace>/<module>/config.xml` * Implemented ability to match URLs in format `protocol://base_url/area/module/controller/action` (as opposite to only `module/controller/action`), utilized this feature in backend (admin) area * Added product attribute set "Minimal Attributes", which consists of required system attributes only * Improved customers import: * Implemented "Delete" behavior for importing customers, customer addresses and financial data * Implemented "Custom" behavior, which allows to specify behavior for each item directly from the imported file * Updated performance tests: * Enabled Product View, Category View, Add to Cart, Quick Search and Advanced Search scenarios * Added ability to specify configuration parameters per scenario and refactored bootstrap of performance tests * Implemented `mage.js` for base JavaScript initialization of the application * Implemented new JS translation mechanism. JavaScript translations are loaded by locale code stored in cookies * Implemented unit tests for JavaScript widgets in Visual Design Editor * Added jQuery plugins: Cookie, Metadata, Validation, Head JS * Fixed issues: * Impossible to add configurable product to the cart * Impossible to apply Shopping Cart Price Rule with any conditions to cart with simple and virtual product * Memory leak in email templates * Impossible to place order with Multiple Addresses using 3D Secure * Required product attributes are not exported * "Forgot Your Password" link on checkout page inactive after captcha reloading * Validation of "Number of Symbols" field in Captcha configuration doesn't work * Other small fixes * GitHub requests: * [#37](#37) -- fixed particular case of "HEADERS ALREADY SENT" error in WYSIWYG thumbnail * [#39](#39) -- added `composer.json` * [#40](#40) -- fixed generation of "secret key" in backend URLs to honor `_forward` in controllers
1 parent 3330e25 commit 1617a6e

File tree

322 files changed

+20833
-3196
lines changed

Some content is hidden

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

322 files changed

+20833
-3196
lines changed

CHANGELOG.markdown

+30
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
Update as of 7/19/2012
2+
=====================
3+
* Implemented inheritance of locales. Inheritance is declared in `app/locale/<locale_name>/config.xml`
4+
* Moved declaration of modules from `app/etc/modules/<module>.xml` to `app/code/<pool>/<namespace>/<module>/config.xml`
5+
* Implemented ability to match URLs in format `protocol://base_url/area/module/controller/action` (as opposite to only `module/controller/action`), utilized this feature in backend (admin) area
6+
* Added product attribute set "Minimal Attributes", which consists of required system attributes only
7+
* Improved customers import:
8+
* Implemented "Delete" behavior for importing customers, customer addresses and financial data
9+
* Implemented "Custom" behavior, which allows to specify behavior for each item directly from the imported file
10+
* Updated performance tests:
11+
* Enabled Product View, Category View, Add to Cart, Quick Search and Advanced Search scenarios
12+
* Added ability to specify configuration parameters per scenario and refactored bootstrap of performance tests
13+
* Implemented `mage.js` for base JavaScript initialization of the application
14+
* Implemented new JS translation mechanism. JavaScript translations are loaded by locale code stored in cookies
15+
* Implemented unit tests for JavaScript widgets in Visual Design Editor
16+
* Added jQuery plugins: Cookie, Metadata, Validation, Head JS
17+
* Fixed issues:
18+
* Impossible to add configurable product to the cart
19+
* Impossible to apply Shopping Cart Price Rule with any conditions to cart with simple and virtual product
20+
* Memory leak in email templates
21+
* Impossible to place order with Multiple Addresses using 3D Secure
22+
* Required product attributes are not exported
23+
* "Forgot Your Password" link on checkout page inactive after captcha reloading
24+
* Validation of "Number of Symbols" field in Captcha configuration doesn't work
25+
* Other small fixes
26+
* GitHub requests:
27+
* [#37](https://github.com/magento/magento2/pull/37) -- fixed particular case of "HEADERS ALREADY SENT" error in WYSIWYG thumbnail
28+
* [#39](https://github.com/magento/magento2/pull/39) -- added `composer.json`
29+
* [#40](https://github.com/magento/magento2/pull/40) -- fixed generation of "secret key" in backend URLs to honor `_forward` in controllers
30+
131
Update as of 7/3/2012
232
=====================
333
* Refactored backend (admin) menu generation:

app/code/community/Phoenix/Moneybookers/etc/config.xml

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<modules>
3030
<Phoenix_Moneybookers>
3131
<version>1.6.0.0</version>
32+
<active>true</active>
33+
<codePool>community</codePool>
3234
</Phoenix_Moneybookers>
3335
</modules>
3436
<global>

app/code/core/Mage/Admin/etc/config.xml

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
<modules>
3030
<Mage_Admin>
3131
<version>1.6.1.0</version>
32+
<active>true</active>
33+
<codePool>core</codePool>
34+
<depends>
35+
<Mage_Core/>
36+
</depends>
3237
</Mage_Admin>
3338
</modules>
3439
</config>

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

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
<modules>
3030
<Mage_AdminNotification>
3131
<version>1.6.0.0</version>
32+
<active>true</active>
33+
<codePool>core</codePool>
34+
<depends>
35+
<Mage_Core/>
36+
<Mage_Adminhtml/>
37+
</depends>
3238
</Mage_AdminNotification>
3339
</modules>
3440
<global>

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Custompath.php

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_Admin_Custompath extends Mage_C
4242
protected function _beforeSave()
4343
{
4444
if ($this->getOldValue() != $this->getValue()) {
45+
Mage::helper('Mage_Backend_Helper_Data')->clearAreaFrontName();
4546
Mage::register('custom_admin_path_redirect', true, true);
4647
}
4748
return $this;

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Observer.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ public function afterCustomUrlChanged($observer)
4242
$adminSession->unsetAll();
4343
$adminSession->getCookie()->delete($adminSession->getSessionName());
4444

45-
$route = ((bool)(string)Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_USE_CUSTOM_ADMIN_PATH))
46-
? Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_CUSTOM_ADMIN_PATH)
47-
: Mage::getConfig()->getNode(Mage_Adminhtml_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME);
45+
$route = Mage::helper('Mage_Backend_Helper_Data')->getAreaFrontName();
4846

4947
Mage::app()->getResponse()
5048
->setRedirect(Mage::getBaseUrl() . $route)

app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Admin/Usecustompath.php

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_Admin_Usecustompath extends Mag
4242
protected function _beforeSave()
4343
{
4444
if ($this->getOldValue() != $this->getValue()) {
45+
Mage::helper('Mage_Backend_Helper_Data')->clearAreaFrontName();
4546
Mage::register('custom_admin_path_redirect', true, true);
4647
}
4748

app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public function thumbnailAction()
189189
$adapter = Mage::helper('Mage_Core_Helper_Data')->getImageAdapterType();
190190
$image = Varien_Image_Adapter::factory($adapter);
191191
$image->open($thumb);
192-
$image->display();
192+
$this->getResponse()->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage());
193193
} else {
194194
// todo: genearte some placeholder
195195
}

app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php

+5-14
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,15 @@ public function directiveAction()
4444
$directive = Mage::helper('Mage_Core_Helper_Data')->urlDecode($directive);
4545
$url = Mage::getModel('Mage_Core_Model_Email_Template_Filter')->filter($directive);
4646
$adapter = Mage::helper('Mage_Core_Helper_Data')->getImageAdapterType();
47+
$image = Varien_Image_Adapter::factory($adapter);
48+
$response = $this->getResponse();
4749
try {
48-
$image = Varien_Image_Adapter::factory($adapter);
4950
$image->open($url);
50-
$image->display();
51+
$response->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage());
5152
} catch (Exception $e) {
52-
$image = Varien_Image_Adapter::factory($adapter);
5353
$image->open(Mage::getSingleton('Mage_Cms_Model_Wysiwyg_Config')->getSkinImagePlaceholderUrl());
54-
$image->display();
55-
/*
56-
$image = imagecreate(100, 100);
57-
$bkgrColor = imagecolorallocate($image,10,10,10);
58-
imagefill($image,0,0,$bkgrColor);
59-
$textColor = imagecolorallocate($image,255,255,255);
60-
imagestring($image, 4, 10, 10, 'Skin image', $textColor);
61-
header('Content-type: image/png');
62-
imagepng($image);
63-
imagedestroy($image);
64-
*/
54+
$response->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage());
55+
Mage::logException($e);
6556
}
6657
}
6758
}

app/code/core/Mage/Adminhtml/etc/config.xml

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
<modules>
3030
<Mage_Adminhtml>
3131
<version>0.7.1</version>
32+
<active>true</active>
33+
<codePool>core</codePool>
34+
<depends>
35+
<Mage_Admin/>
36+
</depends>
3237
</Mage_Adminhtml>
3338
</modules>
3439
<global>

app/code/core/Mage/Adminhtml/view/adminhtml/sales/order/shipment/packaging.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ Packaging.prototype = {
312312

313313
newPackage: function() {
314314
var pack = this.template.cloneNode(true);
315-
pack.id = 'package_block_' + ++this.packageIncrement;
315+
pack.id = 'package_block_' + (++this.packageIncrement);
316316
pack.addClassName('package-block');
317317
pack.select('.package-number span')[0].update(this.packageIncrement);
318318
this.packagesContent.insert({top: pack});

app/code/core/Mage/Api/etc/config.xml

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
<modules>
3030
<Mage_Api>
3131
<version>1.6.0.0</version>
32+
<active>true</active>
33+
<codePool>core</codePool>
34+
<depends>
35+
<Mage_Core />
36+
</depends>
3237
</Mage_Api>
3338
</modules>
3439
<global>

app/code/core/Mage/Api2/etc/config.xml

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
<modules>
3030
<Mage_Api2>
3131
<version>1.0.0.0</version>
32+
<active>true</active>
33+
<codePool>core</codePool>
34+
<depends>
35+
<Mage_Core />
36+
<Mage_Oauth />
37+
</depends>
3238
</Mage_Api2>
3339
</modules>
3440
<global>

app/code/core/Mage/Authorizenet/controllers/Adminhtml/Authorizenet/Directpost/PaymentController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function placeAction()
121121
$adminUrl = Mage::getSingleton('Mage_Adminhtml_Model_Url');
122122
if ($adminUrl->useSecretKey()) {
123123
$requestToPaygate->setKey(
124-
$adminUrl->getSecretKey('authorizenet_directpost_payment','redirect')
124+
$adminUrl->getSecretKey('adminhtml', 'authorizenet_directpost_payment','redirect')
125125
);
126126
}
127127
$result['directpost'] = array('fields' => $requestToPaygate->getData());

app/code/core/Mage/Authorizenet/etc/config.xml

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
<modules>
3030
<Mage_Authorizenet>
3131
<version>1.5.0.0</version>
32+
<active>true</active>
33+
<codePool>core</codePool>
34+
<depends>
35+
<Mage_Paygate/>
36+
<Mage_Sales/>
37+
<Mage_Checkout/>
38+
</depends>
3239
</Mage_Authorizenet>
3340
</modules>
3441
<adminhtml>

app/code/core/Mage/Backend/Block/Menu.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function getCacheKeyInfo()
114114
protected function _afterToHtml($html)
115115
{
116116
$html = preg_replace_callback(
117-
'#'.Mage_Backend_Model_Url::SECRET_KEY_PARAM_NAME.'/\$([^\/].*)/([^\$].*)\$#U',
117+
'#'.Mage_Backend_Model_Url::SECRET_KEY_PARAM_NAME.'/\$([^\/].*)/([^\/].*)/([^\$].*)\$#U',
118118
array($this, '_callbackSecretKey'),
119119
$html
120120
);
@@ -131,7 +131,7 @@ protected function _afterToHtml($html)
131131
protected function _callbackSecretKey($match)
132132
{
133133
return Mage_Backend_Model_Url::SECRET_KEY_PARAM_NAME . '/'
134-
. $this->_url->getSecretKey($match[1], $match[2]);
134+
. $this->_url->getSecretKey($match[1], $match[2], $match[3]);
135135
}
136136

137137
/**

app/code/core/Mage/Backend/Controller/ActionAbstract.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ protected function _forward($action, $controller = null, $module = null, array $
391391
*/
392392
public function getUrl($route='', $params=array())
393393
{
394-
return Mage::helper('Mage_Backend_Helper_Data')->getUrl($route, $params);
394+
return Mage_Backend_Helper_Data::getUrl($route, $params);
395395
}
396396

397397
/**

app/code/core/Mage/Backend/Controller/Router/Default.php

+69-55
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,53 @@
2727

2828
class Mage_Backend_Controller_Router_Default extends Mage_Core_Controller_Varien_Router_Base
2929
{
30+
/**
31+
* List of required request parameters
32+
* Order sensitive
33+
* @var array
34+
*/
35+
protected $_requiredParams = array(
36+
'areaFrontName',
37+
'moduleFrontName',
38+
'controllerName',
39+
'actionName',
40+
);
41+
42+
/**
43+
* Url key of area
44+
*
45+
* @var string
46+
*/
47+
protected $_areaFrontName;
48+
49+
/**
50+
* Fetch area front name from params
51+
*
52+
* @param array $options
53+
* @throws InvalidArgumentException
54+
*/
55+
public function __construct(array $options = array())
56+
{
57+
parent::__construct($options);
58+
$this->_areaFrontName = Mage::helper('Mage_Backend_Helper_Data')->getAreaFrontName();
59+
if (empty($this->_areaFrontName)) {
60+
throw new InvalidArgumentException('Area Front Name should be defined');
61+
}
62+
}
63+
3064
/**
3165
* Fetch default path
3266
*/
3367
public function fetchDefault()
3468
{
69+
$defaultModuleFrontName = (string) Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
3570
// set defaults
3671
$d = explode('/', $this->_getDefaultPath());
3772
$this->getFront()->setDefault(array(
38-
'module' => !empty($d[0]) ? $d[0] : '',
39-
'controller' => !empty($d[1]) ? $d[1] : 'index',
40-
'action' => !empty($d[2]) ? $d[2] : 'index'
73+
'area' => !empty($d[0]) ? $d[0] : '',
74+
'module' => !empty($d[1]) ? $d[1] : $defaultModuleFrontName,
75+
'controller' => !empty($d[2]) ? $d[2] : 'index',
76+
'action' => !empty($d[3]) ? $d[3] : 'index'
4177
));
4278
}
4379

@@ -120,66 +156,26 @@ protected function _getCurrentSecureUrl($request)
120156
*/
121157
public function collectRoutes($configArea, $useRouterName)
122158
{
123-
if ((string)Mage::getConfig()->getNode(Mage_Backend_Helper_Data::XML_PATH_USE_CUSTOM_ADMIN_PATH)) {
124-
$customUrl = (string)Mage::getConfig()->getNode(Mage_Backend_Helper_Data::XML_PATH_CUSTOM_ADMIN_PATH);
125-
$xmlPath = Mage_Backend_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME;
126-
if ((string)Mage::getConfig()->getNode($xmlPath) != $customUrl) {
127-
Mage::getConfig()->setNode($xmlPath, $customUrl, true);
128-
}
129-
}
130-
$this->_collectRoutes('admin', $useRouterName);
159+
parent::collectRoutes('admin', $useRouterName);
131160
}
132161

133162
/**
134-
* Collect modules routers configuration from configuration
163+
* Check whether redirect should be used for secure routes
135164
*
136-
* @param string $configArea
137-
* @param string $useRouterName
138-
* @return void
165+
* @return bool
139166
*/
140-
protected function _collectRoutes($configArea, $useRouterName)
167+
protected function _shouldRedirectToSecure()
141168
{
142-
$routers = array();
143-
$routersConfigNode = Mage::getConfig()->getNode($configArea.'/routers');
144-
if($routersConfigNode) {
145-
$routers = $routersConfigNode->children();
146-
}
147-
foreach ($routers as $routerName=>$routerConfig) {
148-
$use = (string)$routerConfig->use;
149-
if ($use == $useRouterName) {
150-
$modules = array();
151-
if (isset($routerConfig->args->module)) {
152-
$modules = array((string)$routerConfig->args->module);
153-
}
154-
155-
if ($routerConfig->args->modules) {
156-
foreach ($routerConfig->args->modules->children() as $customModule) {
157-
if ($customModule) {
158-
if ($before = $customModule->getAttribute('before')) {
159-
$position = array_search($before, $modules);
160-
if ($position === false) {
161-
$position = 0;
162-
}
163-
array_splice($modules, $position, 0, (string)$customModule);
164-
} elseif ($after = $customModule->getAttribute('after')) {
165-
$position = array_search($after, $modules);
166-
if ($position === false) {
167-
$position = count($modules);
168-
}
169-
array_splice($modules, $position+1, 0, (string)$customModule);
170-
} else {
171-
$modules[] = (string)$customModule;
172-
}
173-
}
174-
}
175-
}
176-
177-
$frontName = (string)$routerConfig->args->frontName;
178-
$this->addModule($frontName, $modules, $routerName);
179-
}
180-
}
169+
return false;
181170
}
182171

172+
/**
173+
* Build controller file name based on moduleName and controllerName
174+
*
175+
* @param string $realModule
176+
* @param string $controller
177+
* @return string
178+
*/
183179
public function getControllerFileName($realModule, $controller)
184180
{
185181
/**
@@ -199,6 +195,13 @@ public function getControllerFileName($realModule, $controller)
199195
return $file . DS . ucfirst($this->_area) . DS . uc_words($controller, DS) . 'Controller.php';
200196
}
201197

198+
/**
199+
* Build controller class name based on moduleName and controllerName
200+
*
201+
* @param string $realModule
202+
* @param string $controller
203+
* @return string
204+
*/
202205
public function getControllerClassName($realModule, $controller)
203206
{
204207
/**
@@ -216,4 +219,15 @@ public function getControllerClassName($realModule, $controller)
216219
$realModule = implode('_', array_splice($parts, 0, 2));
217220
return $realModule . '_' . ucfirst($this->_area) . '_' . uc_words($controller) . 'Controller';
218221
}
222+
223+
/**
224+
* Check whether this router should process given request
225+
*
226+
* @param array $params
227+
* @return bool
228+
*/
229+
protected function _canProcess(array $params)
230+
{
231+
return $params['areaFrontName'] == $this->_areaFrontName;
232+
}
219233
}

0 commit comments

Comments
 (0)