Skip to content

Commit

Permalink
Update as of 7/19/2012
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
magento-team committed Jul 20, 2012
1 parent 3330e25 commit 1617a6e
Show file tree
Hide file tree
Showing 322 changed files with 20,833 additions and 3,196 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
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](https://github.com/magento/magento2/pull/37) -- fixed particular case of "HEADERS ALREADY SENT" error in WYSIWYG thumbnail
* [#39](https://github.com/magento/magento2/pull/39) -- added `composer.json`
* [#40](https://github.com/magento/magento2/pull/40) -- fixed generation of "secret key" in backend URLs to honor `_forward` in controllers

Update as of 7/3/2012
=====================
* Refactored backend (admin) menu generation:
Expand Down
2 changes: 2 additions & 0 deletions app/code/community/Phoenix/Moneybookers/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
<modules>
<Phoenix_Moneybookers>
<version>1.6.0.0</version>
<active>true</active>
<codePool>community</codePool>
</Phoenix_Moneybookers>
</modules>
<global>
Expand Down
5 changes: 5 additions & 0 deletions app/code/core/Mage/Admin/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<modules>
<Mage_Admin>
<version>1.6.1.0</version>
<active>true</active>
<codePool>core</codePool>
<depends>
<Mage_Core/>
</depends>
</Mage_Admin>
</modules>
</config>
6 changes: 6 additions & 0 deletions app/code/core/Mage/AdminNotification/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
<modules>
<Mage_AdminNotification>
<version>1.6.0.0</version>
<active>true</active>
<codePool>core</codePool>
<depends>
<Mage_Core/>
<Mage_Adminhtml/>
</depends>
</Mage_AdminNotification>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_Admin_Custompath extends Mage_C
protected function _beforeSave()
{
if ($this->getOldValue() != $this->getValue()) {
Mage::helper('Mage_Backend_Helper_Data')->clearAreaFrontName();
Mage::register('custom_admin_path_redirect', true, true);
}
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ public function afterCustomUrlChanged($observer)
$adminSession->unsetAll();
$adminSession->getCookie()->delete($adminSession->getSessionName());

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

Mage::app()->getResponse()
->setRedirect(Mage::getBaseUrl() . $route)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Mage_Adminhtml_Model_System_Config_Backend_Admin_Usecustompath extends Mag
protected function _beforeSave()
{
if ($this->getOldValue() != $this->getValue()) {
Mage::helper('Mage_Backend_Helper_Data')->clearAreaFrontName();
Mage::register('custom_admin_path_redirect', true, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function thumbnailAction()
$adapter = Mage::helper('Mage_Core_Helper_Data')->getImageAdapterType();
$image = Varien_Image_Adapter::factory($adapter);
$image->open($thumb);
$image->display();
$this->getResponse()->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage());
} else {
// todo: genearte some placeholder
}
Expand Down
19 changes: 5 additions & 14 deletions app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,15 @@ public function directiveAction()
$directive = Mage::helper('Mage_Core_Helper_Data')->urlDecode($directive);
$url = Mage::getModel('Mage_Core_Model_Email_Template_Filter')->filter($directive);
$adapter = Mage::helper('Mage_Core_Helper_Data')->getImageAdapterType();
$image = Varien_Image_Adapter::factory($adapter);
$response = $this->getResponse();
try {
$image = Varien_Image_Adapter::factory($adapter);
$image->open($url);
$image->display();
$response->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage());
} catch (Exception $e) {
$image = Varien_Image_Adapter::factory($adapter);
$image->open(Mage::getSingleton('Mage_Cms_Model_Wysiwyg_Config')->getSkinImagePlaceholderUrl());
$image->display();
/*
$image = imagecreate(100, 100);
$bkgrColor = imagecolorallocate($image,10,10,10);
imagefill($image,0,0,$bkgrColor);
$textColor = imagecolorallocate($image,255,255,255);
imagestring($image, 4, 10, 10, 'Skin image', $textColor);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
*/
$response->setHeader('Content-Type', $image->getMimeType())->setBody($image->getImage());
Mage::logException($e);
}
}
}
5 changes: 5 additions & 0 deletions app/code/core/Mage/Adminhtml/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<modules>
<Mage_Adminhtml>
<version>0.7.1</version>
<active>true</active>
<codePool>core</codePool>
<depends>
<Mage_Admin/>
</depends>
</Mage_Adminhtml>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ Packaging.prototype = {

newPackage: function() {
var pack = this.template.cloneNode(true);
pack.id = 'package_block_' + ++this.packageIncrement;
pack.id = 'package_block_' + (++this.packageIncrement);
pack.addClassName('package-block');
pack.select('.package-number span')[0].update(this.packageIncrement);
this.packagesContent.insert({top: pack});
Expand Down
5 changes: 5 additions & 0 deletions app/code/core/Mage/Api/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<modules>
<Mage_Api>
<version>1.6.0.0</version>
<active>true</active>
<codePool>core</codePool>
<depends>
<Mage_Core />
</depends>
</Mage_Api>
</modules>
<global>
Expand Down
6 changes: 6 additions & 0 deletions app/code/core/Mage/Api2/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
<modules>
<Mage_Api2>
<version>1.0.0.0</version>
<active>true</active>
<codePool>core</codePool>
<depends>
<Mage_Core />
<Mage_Oauth />
</depends>
</Mage_Api2>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function placeAction()
$adminUrl = Mage::getSingleton('Mage_Adminhtml_Model_Url');
if ($adminUrl->useSecretKey()) {
$requestToPaygate->setKey(
$adminUrl->getSecretKey('authorizenet_directpost_payment','redirect')
$adminUrl->getSecretKey('adminhtml', 'authorizenet_directpost_payment','redirect')
);
}
$result['directpost'] = array('fields' => $requestToPaygate->getData());
Expand Down
7 changes: 7 additions & 0 deletions app/code/core/Mage/Authorizenet/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
<modules>
<Mage_Authorizenet>
<version>1.5.0.0</version>
<active>true</active>
<codePool>core</codePool>
<depends>
<Mage_Paygate/>
<Mage_Sales/>
<Mage_Checkout/>
</depends>
</Mage_Authorizenet>
</modules>
<adminhtml>
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Backend/Block/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function getCacheKeyInfo()
protected function _afterToHtml($html)
{
$html = preg_replace_callback(
'#'.Mage_Backend_Model_Url::SECRET_KEY_PARAM_NAME.'/\$([^\/].*)/([^\$].*)\$#U',
'#'.Mage_Backend_Model_Url::SECRET_KEY_PARAM_NAME.'/\$([^\/].*)/([^\/].*)/([^\$].*)\$#U',
array($this, '_callbackSecretKey'),
$html
);
Expand All @@ -131,7 +131,7 @@ protected function _afterToHtml($html)
protected function _callbackSecretKey($match)
{
return Mage_Backend_Model_Url::SECRET_KEY_PARAM_NAME . '/'
. $this->_url->getSecretKey($match[1], $match[2]);
. $this->_url->getSecretKey($match[1], $match[2], $match[3]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Backend/Controller/ActionAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ protected function _forward($action, $controller = null, $module = null, array $
*/
public function getUrl($route='', $params=array())
{
return Mage::helper('Mage_Backend_Helper_Data')->getUrl($route, $params);
return Mage_Backend_Helper_Data::getUrl($route, $params);
}

/**
Expand Down
124 changes: 69 additions & 55 deletions app/code/core/Mage/Backend/Controller/Router/Default.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,53 @@

class Mage_Backend_Controller_Router_Default extends Mage_Core_Controller_Varien_Router_Base
{
/**
* List of required request parameters
* Order sensitive
* @var array
*/
protected $_requiredParams = array(
'areaFrontName',
'moduleFrontName',
'controllerName',
'actionName',
);

/**
* Url key of area
*
* @var string
*/
protected $_areaFrontName;

/**
* Fetch area front name from params
*
* @param array $options
* @throws InvalidArgumentException
*/
public function __construct(array $options = array())
{
parent::__construct($options);
$this->_areaFrontName = Mage::helper('Mage_Backend_Helper_Data')->getAreaFrontName();
if (empty($this->_areaFrontName)) {
throw new InvalidArgumentException('Area Front Name should be defined');
}
}

/**
* Fetch default path
*/
public function fetchDefault()
{
$defaultModuleFrontName = (string) Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
// set defaults
$d = explode('/', $this->_getDefaultPath());
$this->getFront()->setDefault(array(
'module' => !empty($d[0]) ? $d[0] : '',
'controller' => !empty($d[1]) ? $d[1] : 'index',
'action' => !empty($d[2]) ? $d[2] : 'index'
'area' => !empty($d[0]) ? $d[0] : '',
'module' => !empty($d[1]) ? $d[1] : $defaultModuleFrontName,
'controller' => !empty($d[2]) ? $d[2] : 'index',
'action' => !empty($d[3]) ? $d[3] : 'index'
));
}

Expand Down Expand Up @@ -120,66 +156,26 @@ protected function _getCurrentSecureUrl($request)
*/
public function collectRoutes($configArea, $useRouterName)
{
if ((string)Mage::getConfig()->getNode(Mage_Backend_Helper_Data::XML_PATH_USE_CUSTOM_ADMIN_PATH)) {
$customUrl = (string)Mage::getConfig()->getNode(Mage_Backend_Helper_Data::XML_PATH_CUSTOM_ADMIN_PATH);
$xmlPath = Mage_Backend_Helper_Data::XML_PATH_ADMINHTML_ROUTER_FRONTNAME;
if ((string)Mage::getConfig()->getNode($xmlPath) != $customUrl) {
Mage::getConfig()->setNode($xmlPath, $customUrl, true);
}
}
$this->_collectRoutes('admin', $useRouterName);
parent::collectRoutes('admin', $useRouterName);
}

/**
* Collect modules routers configuration from configuration
* Check whether redirect should be used for secure routes
*
* @param string $configArea
* @param string $useRouterName
* @return void
* @return bool
*/
protected function _collectRoutes($configArea, $useRouterName)
protected function _shouldRedirectToSecure()
{
$routers = array();
$routersConfigNode = Mage::getConfig()->getNode($configArea.'/routers');
if($routersConfigNode) {
$routers = $routersConfigNode->children();
}
foreach ($routers as $routerName=>$routerConfig) {
$use = (string)$routerConfig->use;
if ($use == $useRouterName) {
$modules = array();
if (isset($routerConfig->args->module)) {
$modules = array((string)$routerConfig->args->module);
}

if ($routerConfig->args->modules) {
foreach ($routerConfig->args->modules->children() as $customModule) {
if ($customModule) {
if ($before = $customModule->getAttribute('before')) {
$position = array_search($before, $modules);
if ($position === false) {
$position = 0;
}
array_splice($modules, $position, 0, (string)$customModule);
} elseif ($after = $customModule->getAttribute('after')) {
$position = array_search($after, $modules);
if ($position === false) {
$position = count($modules);
}
array_splice($modules, $position+1, 0, (string)$customModule);
} else {
$modules[] = (string)$customModule;
}
}
}
}

$frontName = (string)$routerConfig->args->frontName;
$this->addModule($frontName, $modules, $routerName);
}
}
return false;
}

/**
* Build controller file name based on moduleName and controllerName
*
* @param string $realModule
* @param string $controller
* @return string
*/
public function getControllerFileName($realModule, $controller)
{
/**
Expand All @@ -199,6 +195,13 @@ public function getControllerFileName($realModule, $controller)
return $file . DS . ucfirst($this->_area) . DS . uc_words($controller, DS) . 'Controller.php';
}

/**
* Build controller class name based on moduleName and controllerName
*
* @param string $realModule
* @param string $controller
* @return string
*/
public function getControllerClassName($realModule, $controller)
{
/**
Expand All @@ -216,4 +219,15 @@ public function getControllerClassName($realModule, $controller)
$realModule = implode('_', array_splice($parts, 0, 2));
return $realModule . '_' . ucfirst($this->_area) . '_' . uc_words($controller) . 'Controller';
}

/**
* Check whether this router should process given request
*
* @param array $params
* @return bool
*/
protected function _canProcess(array $params)
{
return $params['areaFrontName'] == $this->_areaFrontName;
}
}
Loading

0 comments on commit 1617a6e

Please sign in to comment.