Skip to content

Commit

Permalink
Merge remote-tracking branch 'm2origin/develop' into MAGETWO-66470
Browse files Browse the repository at this point in the history
  • Loading branch information
vklymenko committed Mar 28, 2017
2 parents aa274dc + be7cbf2 commit 7e7d6db
Show file tree
Hide file tree
Showing 565 changed files with 8,659 additions and 2,839 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![Build Status](https://travis-ci.org/magento/magento2.svg?branch=develop)](https://travis-ci.org/magento/magento2)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.png)](https://crowdin.com/project/magento-2)
<h2>Welcome</h2>
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting edge, feature-rich eCommerce solution that gets results.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
name="notification_window"
as="notification_window"
acl="Magento_AdminNotification::show_toolbar"
template="notification/window.phtml"/>
template="Magento_AdminNotification::notification/window.phtml"/>
</referenceContainer>
<referenceContainer name="header">
<block class="Magento\AdminNotification\Block\ToolbarEntry" name="notification.messages" before="user" template="toolbar_entry.phtml"/>
<block class="Magento\AdminNotification\Block\ToolbarEntry" name="notification.messages" before="user" template="Magento_AdminNotification::toolbar_entry.phtml"/>
</referenceContainer>
</body>
</page>
12 changes: 0 additions & 12 deletions app/code/Magento/Analytics/Api/Data/LinkInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,4 @@ public function getUrl();
* @return string
*/
public function getInitializationVector();

/**
* @param string $url
* @return void
*/
public function setUrl($url);

/**
* @param string $initializationVector
* @return void
*/
public function setInitializationVector($initializationVector);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Analytics\Block\Adminhtml\System\Config;

/**
* Provides field with additional information
*/
class AdditionalComment extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$html = '<div class="config-additional-comment-title">' . $element->getLabel() . '</div>';
$html .= '<div class="config-additional-comment-content">' . $element->getComment() . '</div>';
return $this->decorateRowHtml($element, $html);
}

/**
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @param string $html
* @return string
*/
private function decorateRowHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element, $html)
{
return sprintf(
'<tr id="row_%s"><td colspan="3"><div class="config-additional-comment">%s</div></td></tr>',
$element->getHtmlId(),
$html
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Analytics\Block\Adminhtml\System\Config;

/**
* Provides label with default Time Zone
*/
class CollectionTimeLabel extends \Magento\Config\Block\System\Config\Form\Field
{
/**
* Add default time zone to comment
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$timeZoneCode = $this->_localeDate->getConfigTimezone();
$getLongTimeZoneName = \IntlTimeZone::createTimeZone($timeZoneCode)->getDisplayName();
$element->setData(
'comment',
sprintf("%s (%s)", $getLongTimeZoneName, $timeZoneCode)
);
return parent::render($element);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ public function __construct(
}

/**
* Unset some non-related element parameters
* Add Subscription status to comment
*
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
* @return string
*/
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
$element->setData(
'value',
'comment',
$this->prepareLabelValue()
);
return parent::render($element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,38 @@
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Analytics\Controller\Adminhtml\BasicTier;
namespace Magento\Analytics\Controller\Adminhtml\BIEssentials;

use Magento\Backend\App\Action;
use Magento\Config\Model\Config;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\Config\ScopeConfigInterface;

/**
* Class SignUp
*
* Provides link to Basic Tier signup
* Provides link to BI Essentials signup
*/
class SignUp extends Action
{
/**
* Path to config value with URL to BI Essentials sign-up page.
*
* @var string
*/
private $basicTierUrlPath = 'analytics/url/basic_tier';
private $urlBIEssentialsConfigPath = 'analytics/url/bi_essentials';

/**
* @var Config
* @var ScopeConfigInterface
*/
private $config;

/**
* @param Context $context
* @param Config $config
* @param ScopeConfigInterface $config
*/
public function __construct(
Context $context,
Config $config
ScopeConfigInterface $config
) {
$this->config = $config;
parent::__construct($context);
Expand All @@ -45,18 +47,18 @@ public function __construct(
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Magento_Analytics::report_basic_tier');
return $this->_authorization->isAllowed('Magento_Analytics::bi_essentials');
}

/**
* Provides link to Basic Tier signup
* Provides link to BI Essentials signup
*
* @return \Magento\Framework\Controller\AbstractResult
*/
public function execute()
{
return $this->resultRedirectFactory->create()->setUrl(
$this->config->getConfigDataValue($this->basicTierUrlPath)
$this->config->getValue($this->urlBIEssentialsConfigPath)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
use Psr\Log\LoggerInterface;

/**
* Class Activate
*
* Activates subscription with Free Tier program
* Activates subscription to Magento BI Advanced Reporting.
*/
class Activate extends Action
{
/**
* Resource for managing subscription to Magento Analytics.
* Resource for managing subscription to Magento BI.
*
* @var Subscription
*/
Expand All @@ -35,7 +33,7 @@ class Activate extends Action
private $logger;

/**
* Resource for managing last notification time about subscription to Magento Analytics.
* Resource for managing last notification time about subscription to Magento BI.
*
* @var NotificationTime
*/
Expand Down Expand Up @@ -79,7 +77,7 @@ protected function _isAllowed()
}

/**
* Activate subscription to Magento Analytics via AJAX.
* Activate subscription to Magento BI via AJAX.
*
* @return Json
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
use Psr\Log\LoggerInterface;

/**
* Class Postpone
*
* Postpones notification about Free Tier program
* Postpones notification about subscription to Magento BI Advanced Reporting.
*/
class Postpone extends Action
{
Expand All @@ -38,8 +36,6 @@ class Postpone extends Action
private $logger;

/**
* Postpone constructor.
*
* @param Context $context
* @param DateTimeFactory $dateTimeFactory
* @param NotificationTime $notificationTime
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
/**
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Analytics\Controller\Adminhtml\Subscription;

use Magento\Analytics\Model\Subscription;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\Result\Redirect;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Exception\LocalizedException;

/**
* Retry subscription to Magento BI Advanced Reporting.
*/
class Retry extends Action
{
/**
* Resource for managing subscription to Magento Analytics.
*
* @var Subscription
*/
private $subscription;

/**
* @param Context $context
* @param Subscription $subscription
*/
public function __construct(
Context $context,
Subscription $subscription
) {
$this->subscription = $subscription;
parent::__construct($context);
}

/**
* Check admin permissions for this controller
*
* @return boolean
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Magento_Analytics::analytics_settings');
}

/**
* Retry process of subscription.
*
* @return Redirect
*/
public function execute()
{
/** @var Redirect $resultRedirect */
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
try {
$resultRedirect->setPath('adminhtml');
$this->subscription->retry();
} catch (LocalizedException $e) {
$this->getMessageManager()->addExceptionMessage($e, $e->getMessage());
} catch (\Exception $e) {
$this->getMessageManager()->addExceptionMessage(
$e,
__('Sorry, there has been an error processing your request. Please try again later.')
);
}

return $resultRedirect;
}
}
32 changes: 1 addition & 31 deletions app/code/Magento/Analytics/Cron/SignUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use Magento\Analytics\Model\Config\Backend\Enabled\SubscriptionHandler;
use Magento\Framework\App\Config\ReinitableConfigInterface;
use Magento\Framework\App\Config\Storage\WriterInterface;
use Magento\AdminNotification\Model\InboxFactory;
use Magento\AdminNotification\Model\ResourceModel\Inbox as InboxResource;
use Magento\Analytics\Model\FlagManager;

/**
Expand All @@ -28,16 +26,6 @@ class SignUp
*/
private $configWriter;

/**
* @var InboxFactory
*/
private $inboxFactory;

/**
* @var InboxResource
*/
private $inboxResource;

/**
* @var FlagManager
*/
Expand All @@ -51,27 +39,19 @@ class SignUp
private $reinitableConfig;

/**
* SignUp constructor.
*
* @param Connector $connector
* @param WriterInterface $configWriter
* @param InboxFactory $inboxFactory
* @param InboxResource $inboxResource
* @param FlagManager $flagManager
* @param ReinitableConfigInterface $reinitableConfig
*/
public function __construct(
Connector $connector,
WriterInterface $configWriter,
InboxFactory $inboxFactory,
InboxResource $inboxResource,
FlagManager $flagManager,
ReinitableConfigInterface $reinitableConfig
) {
$this->connector = $connector;
$this->configWriter = $configWriter;
$this->inboxFactory = $inboxFactory;
$this->inboxResource = $inboxResource;
$this->flagManager = $flagManager;
$this->reinitableConfig = $reinitableConfig;
}
Expand All @@ -85,20 +65,10 @@ public function __construct(
public function execute()
{
$attemptsCount = $this->flagManager->getFlagData(SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE);
if ($attemptsCount === null) {
$this->deleteAnalyticsCronExpr();
return false;
}

if ($attemptsCount <= 0) {
if (($attemptsCount === null) || ($attemptsCount <= 0)) {
$this->deleteAnalyticsCronExpr();
$this->flagManager->deleteFlag(SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE);
$inboxNotification = $this->inboxFactory->create();
$inboxNotification->addNotice(
"Analytics subscription unsuccessful",
"Analytics subscription unsuccessful"
);
$this->inboxResource->save($inboxNotification);
return false;
}

Expand Down
Loading

0 comments on commit 7e7d6db

Please sign in to comment.