Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into prs-ee
Browse files Browse the repository at this point in the history
  • Loading branch information
vpelipenko committed Jul 24, 2015
2 parents 21b4142 + 3e132a3 commit db5ec19
Show file tree
Hide file tree
Showing 202 changed files with 6,323 additions and 3,550 deletions.
1 change: 0 additions & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
->exclude('dev/tests/integration/var')
->exclude('lib/internal/Cm')
->exclude('lib/internal/Credis')
->exclude('lib/internal/JSMin')
->exclude('lib/internal/Less')
->exclude('lib/internal/LinLibertineFont')
->exclude('lib/internal/phpseclib')
Expand Down
3 changes: 3 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ module.exports = function (grunt) {
[
taskDir + '/mage-minify',
taskDir + '/deploy',
taskDir + '/black-list-generator',
taskDir + '/clean-black-list',
taskDir + '/static',
'time-grunt'
].forEach(function (task) {
require(task)(grunt);
Expand Down
4 changes: 3 additions & 1 deletion app/code/Magento/Authorizenet/Helper/Backend/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function __construct(
OrderFactory $orderFactory,
UrlInterface $backendUrl
) {
$this->_urlBuilder = $backendUrl;
parent::__construct($context, $storeManager, $orderFactory);
$this->_urlBuilder = $backendUrl;
}

/**
Expand Down Expand Up @@ -85,6 +85,8 @@ public function getRedirectIframeUrl($params)
*
* @param null|int|string $storeId
* @return string
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getRelayUrl($storeId = null)
{
Expand Down
151 changes: 24 additions & 127 deletions app/code/Magento/Authorizenet/view/adminhtml/web/js/direct-post.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ directPost.prototype = {
this.headers = [];
this.isValid = true;
this.paymentRequestSent = false;
this.isResponse = false;
this.orderIncrementId = false;
this.successUrl = false;
this.hasError = false;
this.tmpForm = false;

this.onSaveOnepageOrderSuccess = this.saveOnepageOrderSuccess.bindAsEventListener(this);
this.onLoadIframe = this.loadIframe.bindAsEventListener(this);
this.onLoadOrderIframe = this.loadOrderIframe.bindAsEventListener(this);
this.onSubmitAdminOrder = this.submitAdminOrder.bindAsEventListener(this);
Expand Down Expand Up @@ -80,63 +78,30 @@ directPost.prototype = {
.off('submitOrder')
.on('submitOrder', this.submitAdminOrder.bind(this));
if ($(this.iframeId)) {
switch (this.controller) {
case 'onepage':
this.headers = $$('#' + checkout.accordion.container.readAttribute('id') + ' .section');
var button = $('review-buttons-container').down('button');
button.writeAttribute('onclick', '');
button.stopObserving('click');
button.observe('click', function() {
if ($(this.iframeId)) {
if (this.validate()) {
this.saveOnepageOrder();
}
} else {
review.save();
}
}.bind(this));
break;
case 'order_create':
case 'order_edit':
// Temporary solution will be removed after refactoring Authorize.Net (sales) functionality
jQuery('.scalable.save:not(disabled)').removeAttr('onclick');
jQuery(document).off('click.directPost');
jQuery(document).on(
'click.directPost',
'.scalable.save:not(disabled)',
jQuery.proxy(this.onSubmitAdminOrder, this)
);

$('order-' + this.iframeId).observe('load', this.onLoadOrderIframe);
break;
}

// Temporary solution will be removed after refactoring Authorize.Net (sales) functionality
jQuery('.scalable.save:not(disabled)').removeAttr('onclick');
jQuery(document).off('click.directPost');
jQuery(document).on(
'click.directPost',
'.scalable.save:not(disabled)',
jQuery.proxy(this.onSubmitAdminOrder, this)
);
$('order-' + this.iframeId).observe('load', this.onLoadOrderIframe);
$(this.iframeId).observe('load', this.onLoadIframe);
}
},

loadIframe : function() {
if (this.paymentRequestSent) {
switch (this.controller) {
case 'onepage':
this.paymentRequestSent = false;
if (!this.hasError) {
this.returnQuote();
}
break;
case 'order_edit':
case 'order_create':
if (!this.orderRequestSent) {
this.paymentRequestSent = false;
if (!this.hasError) {
this.returnQuote();
} else {
this.changeInputOptions('disabled', false);
jQuery('body').trigger('processStop');
enableElements('save');
}
}
break;
if (!this.orderRequestSent) {
this.paymentRequestSent = false;
if (!this.hasError) {
this.returnQuote();
} else {
this.changeInputOptions('disabled', false);
jQuery('body').trigger('processStop');
enableElements('save');
}
}
if (this.tmpForm) {
document.body.removeChild(this.tmpForm);
Expand Down Expand Up @@ -167,25 +132,17 @@ directPost.prototype = {
new Ajax.Request(url, {
onSuccess : function(transport) {
try {
response = eval('(' + transport.responseText + ')');
response = transport.responseText.evalJSON(true);
} catch (e) {
response = {};
}
if (response.error_message) {
alert(response.error_message);
}
$(this.iframeId).show();
switch (this.controller) {
case 'onepage':
this.resetLoadWaiting();
break;
case 'order_edit':
case 'order_create':
this.changeInputOptions('disabled', false);
jQuery('body').trigger('processStop');
enableElements('save');
break;
}
this.changeInputOptions('disabled', false);
jQuery('body').trigger('processStop');
enableElements('save');
}.bind(this)
});
},
Expand All @@ -204,66 +161,6 @@ directPost.prototype = {
checkout.setLoadWaiting(false);
},

saveOnepageOrder : function() {
this.hasError = false;
this.setLoadWaiting();
var params = Form.serialize(payment.form);
if (review.agreementsForm) {
params += '&' + Form.serialize(review.agreementsForm);
}
params += '&controller=' + this.controller;
new Ajax.Request(this.orderSaveUrl, {
method : 'post',
parameters : params,
onComplete : this.onSaveOnepageOrderSuccess,
onFailure : function(transport) {
this.resetLoadWaiting();
if (transport.status == 403) {
checkout.ajaxFailure();
}
}
});
},

saveOnepageOrderSuccess : function(transport) {
if (transport.status == 403) {
checkout.ajaxFailure();
}
try {
response = eval('(' + transport.responseText + ')');
} catch (e) {
response = {};
}

if (response.success && response.directpost) {
this.orderIncrementId = response.directpost.fields.x_invoice_num;
var paymentData = {};
for ( var key in response.directpost.fields) {
paymentData[key] = response.directpost.fields[key];
}
var preparedData = this.preparePaymentRequest(paymentData);
this.sendPaymentRequest(preparedData);
} else {
var msg = response.error_messages;
if (typeof (msg) == 'object') {
msg = msg.join("\n");
}
if (msg) {
alert(msg);
}

if (response.update_section) {
$('checkout-' + response.update_section.name + '-load').replace(response.update_section.html);
response.update_section.html.evalScripts();
}

if (response.goto_section) {
checkout.gotoSection(response.goto_section);
checkout.reloadProgressBlock();
}
}
},

submitAdminOrder : function() {
// Temporary solution will be removed after refactoring Authorize.Net (sales) functionality
var editForm = jQuery('#edit_form');
Expand Down Expand Up @@ -324,7 +221,7 @@ directPost.prototype = {

saveAdminOrderSuccess : function(data) {
try {
response = eval('(' + data + ')');
response = data.evalJSON(true);
} catch (e) {
response = {};
}
Expand Down Expand Up @@ -423,4 +320,4 @@ directPost.prototype = {
}
}
};
}));
}));
18 changes: 18 additions & 0 deletions app/code/Magento/Backend/Block/Cache/Additional.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@

class Additional extends \Magento\Backend\Block\Template
{
/**
* Check if application is in production mode
*
* @return bool
*/
public function isInProductionMode()
{
return $this->_appState->getMode() === \Magento\Framework\App\State::MODE_PRODUCTION;
}

/**
* @return string
*/
Expand All @@ -22,4 +32,12 @@ public function getCleanMediaUrl()
{
return $this->getUrl('*/*/cleanMedia');
}

/**
* @return string
*/
public function getCleanStaticFilesUrl()
{
return $this->getUrl('*/*/cleanStaticFiles');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
*
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Backend\Controller\Adminhtml\Cache;

use Magento\Framework\Controller\ResultFactory;

class CleanStaticFiles extends \Magento\Backend\Controller\Adminhtml\Cache
{
/**
* Clean static files cache
*
* @return \Magento\Backend\Model\View\Result\Redirect
*/
public function execute()
{
$this->_objectManager->get('Magento\Framework\App\State\CleanupFiles')->clearMaterializedViewFiles();
$this->_eventManager->dispatch('clean_static_files_cache_after');
$this->messageManager->addSuccess(__('The static files cache has been cleaned.'));

/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
return $resultRedirect->setPath('adminhtml/*');
}
}
8 changes: 6 additions & 2 deletions app/code/Magento/Backend/Setup/ConfigOptionsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Magento\Framework\Setup\ConfigOptionsListInterface;
use Magento\Framework\Setup\Option\TextConfigOption;
use Magento\Framework\App\DeploymentConfig;
use \Magento\Framework\Setup\BackendFrontnameGenerator;

/*
* Deployment configuration options needed for Backend module
Expand All @@ -36,8 +37,7 @@ public function getOptions()
self::INPUT_KEY_BACKEND_FRONTNAME,
TextConfigOption::FRONTEND_WIZARD_TEXT,
self::CONFIG_PATH_BACKEND_FRONTNAME,
'Backend frontname',
'admin'
'Backend frontname (will be autogenerated if missing)'
)
];
}
Expand All @@ -50,6 +50,10 @@ public function createConfig(array $options, DeploymentConfig $deploymentConfig)
{
$configData = new ConfigData(ConfigFilePool::APP_ENV);

if (!$deploymentConfig->get(self::CONFIG_PATH_BACKEND_FRONTNAME)
&& !isset($options[self::INPUT_KEY_BACKEND_FRONTNAME])) {
$options[self::INPUT_KEY_BACKEND_FRONTNAME] = BackendFrontnameGenerator::generate();
}
if (isset($options[self::INPUT_KEY_BACKEND_FRONTNAME])) {
$configData->set(self::CONFIG_PATH_BACKEND_FRONTNAME, $options[self::INPUT_KEY_BACKEND_FRONTNAME]);
}
Expand Down
Loading

0 comments on commit db5ec19

Please sign in to comment.